简体   繁体   中英

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 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM