Asp.Net : Web service throws "Thread was being aborted"

Posted by Master Morality on Stack Overflow See other posts from Stack Overflow or by Master Morality
Published on 2010-04-09T21:03:18Z Indexed on 2010/04/09 21:13 UTC
Read the original article Hit count: 409

Filed under:
|
|

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... */
    ...
}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about web-services