I have a javascript funtion that will called a controller method if the condition satisfied.
In SilentLogout method, it returns RedirectToAction method.
For this SilentLogout method, there is no view associated with it.
The codes work well except it cannot find the the SilentLogout.
Just fyi, there are other methods in this controller which returns view and it all works well.
Advertisement
Answer
Changing the window.location.href
performs a “GET”.
Unless there’s a [HttpGet]
sitting above your [HttpPost]
you’ve locked that action to “POST” only. Just remove the [HttpPost]
attribute. there’s probably no reason to lock down a logout method anyway.