简体   繁体   English

Url.Action 找不到返回 RedirectToAction 的 controller 方法

[英]Url.Action cant find controller method which returns RedirectToAction

I have a javascript funtion that will called a controller method if the condition satisfied.我有一个 javascript 函数,如果条件满足,它将调用 controller 方法。

在里面

In SilentLogout method, it returns RedirectToAction method.在 SilentLogout 方法中,它返回 RedirectToAction 方法。

在此处输入图像描述

For this SilentLogout method, there is no view associated with it.对于此 SilentLogout 方法,没有与之关联的视图。

The codes work well except it cannot find the the SilentLogout.代码运行良好,但找不到 SilentLogout。 在此处输入图像描述

Just fyi, there are other methods in this controller which returns view and it all works well.仅供参考,此 controller 中还有其他方法可以返回视图,并且一切正常。

Changing the window.location.href performs a "GET".更改window.location.href会执行“GET”。 Unless there's a [HttpGet] sitting above your [HttpPost] you've locked that action to "POST" only.除非您的[HttpPost]上方有一个[HttpGet] ,否则您已将该操作锁定为仅“POST”。 Just remove the [HttpPost] attribute.只需删除[HttpPost]属性。 there's probably no reason to lock down a logout method anyway.无论如何,可能没有理由锁定注销方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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