I have a web service that I call via ajax that requires the user to be logged in. in each method I want to check if the user is logged in and send a 403 code if they are not, however when I call a Response.End()
I get the error "Thread was being aborted". What should I call instead?
[WebMethod(true)]
public string MyMethod()
{
if(!userIsLoggedIn)
{
HttpContext.Current.Response.StatusCode = 403;
HttpContext.Current.Response.End();
}
/* Do stuff that should not execute unless the user is logged in... */
...
}