using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;/// <summary>
/// Summary description for globalfunc
/// </summary>
///
namespace globalfunc
{
public class globalfuncc : System.Web.UI.Page
{
public void globalfuncf(ref int mm)
{
mm = mm + 1;
Response.Write("<script language=javascript>alert(" + mm.ToString() + ");</script>");////这句出现错误。出错如下。。
} }
}这是我自定义的一个命名空间。我的本意是将其做为全局的函数来调用。
可是程序一到response.write...这句时就会报错,:Response is not available in this context.这是为何呢?如果在外面定义为一个函数则没有任何问题。我将上面所写的代码放在app_code中。请高手指教。
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;/// <summary>
/// Summary description for globalfunc
/// </summary>
///
namespace globalfunc
{
public class globalfuncc : System.Web.UI.Page
{
public void globalfuncf(ref int mm)
{
mm = mm + 1;
Response.Write("<script language=javascript>alert(" + mm.ToString() + ");</script>");////这句出现错误。出错如下。。
} }
}这是我自定义的一个命名空间。我的本意是将其做为全局的函数来调用。
可是程序一到response.write...这句时就会报错,:Response is not available in this context.这是为何呢?如果在外面定义为一个函数则没有任何问题。我将上面所写的代码放在app_code中。请高手指教。
解决方案 »
- C#调用VCdll时PVOID 数据类型怎么转换
- 想自己做用户控件,求教程~~~~~~~~~~~~~~~~~~
- 输入一串字符,如"this is test",将这串字符反向输出,也就是"test is this",请问大哥大姐怎么去实现它,请贴出代码,谢谢.
- 新手使用console.writelean()问题:未处理 System.FormatException
- 验证码识别为字符
- IP转化域名
- 请求C#指导
- 能不能动态创建类?
- 如何调试IhttpHandler?
- SQL查询一个月内每一个人的考勤记录同一个人的显示在当天的同一行中
- B/S中如何用C#在页面上显示图片
- vs.net2005中的serialport控件有没有办法在2003中使用! 急!!!
Response.Write(str1);
看看
public class PageDownload : Page
{
protected override void OnLoad(EventArgs e)
{
if (!IsPostBack)
{ Response.ClearContent();
Response.ContentType = "application/stream";
Response.TransmitFile(Globals.FileRoot + @"App_Data\3\030002.wps");
}
}
}
[/code]