private static HttpContext context = HttpContext.Current;
2005-12-20 00:17 晓风残月 阅读(716) 评论(0) 编辑 收藏 举报刚刚写了个静态方法:
private static HttpContext context = HttpContext.Current;
public static void PopMsg(MsgType type)
{
string msg = GetMsg( type );
string script = "<script language='javascript'>alert('" +
msg + "')</script>";
//HttpContext.Current.Response.Write(script);
context.Response.Write(script);
}
第一次提交可以,第二次调用PopMsg就报错了:
将context.Response.Write(script);改为HttpContext.Current.Response.Write(script);就OK了,
记下,待研究
值不能为空。参数名: destination
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentNullException: 值不能为空。参数名: destination
源错误: