Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个网址
http://localhost:49460/Account/Login?ReturnUrl=%2fusers%2fuser%2f5199
如何重定向到视图Users/User/5199?
Users/User/5199
首先将ReturnUrl作为字符串参数传递给控制器,如果它不为空,则重定向到该字符串值,如下所示:
ReturnUrl
public ActionResult Login(string ReturnUrl){ //logic here if (ReturnUrl != null){ return Redirect(ReturnUrl); } //Default return in case ReturnUrl is null goes here }