System.Threading."ThreadAbortException" - verursacht durch die Reaktion.Umleiten

In meinem Antrag fordere ich eine WebMethod von JavaScript, wo ich versuche, einen redirect zu einer Seite:

[WebMethod]
public string Logout() {            
    if (User.Identity.IsAuthenticated) {                            
        HttpContext.Current.Response.Redirect("~/Pages/Logout.aspx");               
    }
    return "";
}

Die aspx-Seite:

    <input onclick="callLogout();" id="btn" type="button" value="Click Me" />

    <asp:ScriptManager ID="ScriptManager" runat="server">
        <Services>
            <asp:ServiceReference Path="~/WebServices/EMSWebService.asmx" />
        </Services>
    </asp:ScriptManager>
    <script type="text/javascript">        
        function callLogout() {
            EMSApplication.Web.WebServices.EMSWebService.Logout(OnComplete, OnError);
        }

        function OnComplete(result) {
            alert(result);
        }

        function OnError(result) {
            alert(result.get_message());
        }
    </script>

Und ich bin immer:

Erste chance Ausnahme des Typs
'System.Threading.ThreadAbortException' ist in mscorlib.dll

Eine Ausnahme des Typs " System.Threading.ThreadAbortException' ist in
"mscorlib".die dll wurde aber nicht behandelt werden, in Benutzer-code

in meinem VS2010 Output-Fenster.

Warum bin ich immer diese exception und wie kann ich dies beheben?

InformationsquelleAutor Tapas Bose | 2012-04-01

Schreibe einen Kommentar