我的应用程序的global.asax文件中有一些代码。每次我调试我的网站时,我都会因为某些原因得到一个sqlexception:
void Application_AuthorizeRequest(object sender, EventArgs e)
{
if (Membership.GetUser() != null && Roles.IsUserInRole("UnFilled")) // this is where I get the exception
{
if (Response.Cookies["Expiration"] == null)
{
HttpRequest request = Context.Request;
HttpResponse response = Context.Response;
response.ContentType = ".aspx";
response.Write(request.Url.Host + "/Activate.aspx?account="+Membership.GetUser().Email);
}
}
}有人知道我为什么会这样吗,我该怎么解决它?
发布于 2012-09-08 11:51:22
我已经找到了答案,但不确定为什么它会起作用。如果我将代码放入一个自定义的http处理程序中,它似乎可以工作。
感谢所有的贡献。
https://stackoverflow.com/questions/11706416
复制相似问题