将查询字符串参数传递给 .net mvc 中的 UrlHelper.Action 方法

Vai*_*ani 7 asp.net-mvc

我有类似的方法

 UrlHelper.Action("login", "Authentication", HttpContext.Current.Request.Url.Scheme);
Run Code Online (Sandbox Code Playgroud)

我想传递查询字符串参数,如“referrer?” = pageName 到这个方法。我该怎么做?

use*_*165 4

您只需像这样声明您的参数:

UrlHelper.Action("login", "Authentication", new { referrer = "Page Name" })
Run Code Online (Sandbox Code Playgroud)

然后在你的Action中获取参数:

Request.Params["referrer"]
Run Code Online (Sandbox Code Playgroud)