I have this function that utilizes jQuery's post feature to send an ajax request to my logout handler, which destroys the session (set by asp.net) and redirects to the login page:
<script type="text/javascript">
//<![CDATA[
function doLogout() {
var conf = false;
conf = confirm("Really log out?");
if (conf === true) {
$.post("logout.ashx");
}
}
//]]>
</script>
So far, the logout link functions fine: user clicks it, the confirmation box pops up, and if they click yes it loads up the logout handler:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
With context
If .Session IsNot Nothing Then
context.Session.Clear()
context.Session.Abandon()
End If
.Server.Transfer("default.aspx", False)
End With
End Sub
I have tried using Response.Redirect
as well, nothing different happens.
I have verified by tracing that everything is functioning fine. There are no javascript or asp.net errors. The only problem is the page in the browser does not change.
Any ideas?