Skip to content
Advertisement

Url.Action cant find controller method which returns RedirectToAction

I have a javascript funtion that will called a controller method if the condition satisfied.

In the

In SilentLogout method, it returns RedirectToAction method.

enter image description here

For this SilentLogout method, there is no view associated with it.

The codes work well except it cannot find the the SilentLogout. enter image description here

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.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement