I can not close an open session.
I use this method but it DOES NOT WORK.
<a>
href="@Url.Action("CerrarSesion","Home")"> <i class="icon-key"></i> Cerrar Sesión
</a>
Here I have the driver.
<HttpPost()>
Function CerrarSesion() As ActionResult
If IsNothing(Session) = False Then
Session("usuario") = Nothing
Session("usu") = Nothing
Session.Clear()
Session.Abandon()
End If
FormsAuthentication.SignOut()
Return RedirectToAction("Index", "Home")
End Function
When he uses this form he tells me that he "can not find the resource".
and here I have this function and use it on a button and it does not work ...
<script type = "text/javascript">
function SessionAbandon() {
$.ajax({
type: "POST",
url: "/Home/CerrarSesion",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus + ": " + XMLHttpRequest.responseText);
}
});
}
</script>