简体   繁体   English

重定向到另一个控制器

[英]Redirecting to Another Controller

At the risk of sounding dumb. 听起来很愚蠢。

I am trying to redirect to an action in another controller 我正在尝试重定向到另一个控制器中的操作

here is my code 这是我的代码

     return this.RedirectToAction("s", "profile", new { id = CleanerId });

why is it not working? 为什么不工作?

"s" is the controller, "profile" is the action. “s”是控制器,“profile”是动作。

Switch the s and profile , you have them reversed. 切换sprofile ,你可以颠倒它们。 RedirectToAction RedirectToAction

That is Very Simple to redirect one controller to another. 将一个控制器重定向到另一个控制器非常简单。 if you are using are using Area concept then you can write this code like this: return RedirectToAction("LogIn", "Account", new { area = "Admin" }) and if you not use Area Concept then you can write this kind : return RedirectToAction("LogIn", "Account", new { area = "" }) I hope so this article useful to you. 如果您正在使用区域概念,那么您可以像这样编写此代码: return RedirectToAction(“LogIn”,“Account”,new {area =“Admin”})如果您不使用Area Concept,那么您可以写这种: return RedirectToAction(“LogIn”,“Account”,new {area =“”})我希望这篇文章对你有用。

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

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