I have some code in the global.asax file in my application. Each time I debug my website I get a sqlexception for some reason:
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);
}
}
}
anyone know why I get this, how can I solve it?
I have found an answer, but not sure why it works. It seems to work if I place the coding into a custom http handler.
Thanks to all that contributed.