I have tried to logout from a session by calling a C# action but it shows an error logout not found
take a look at it,
Controller Action:
[Authorize]
[HttpPost]
public ActionResult Logout()
{
Session.Clear();
FormsAuthentication.SignOut();
return RedirectToAction("Index", "Home");
}
I have used a simple Javascript to automate this after 5 seconds JS:
<script type="text/javascript">
window.setTimeout(function(){
window.location.href = '@Url.Action("Logout", "Home", FormMethod.Post)';
}, 5000);
</script>
But the compiler is showing this error:enter image description here
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Home/Logout