开发者

ASP.NET MVC 2 - How do I pass a querystring back on response?

开发者 https://www.devze.com 2023-01-17 19:06 出处:网络
I need to pass a que开发者_如何学Crystring back on response - so that via means of jQuery I can do something with it.

I need to pass a que开发者_如何学Crystring back on response - so that via means of jQuery I can do something with it.

something like this: return RedirectToAction("LogOn", "Account", new { id = "?action=update" });

URL needs to end up like: ../Account/LogOn/?action=update

but the above code produces this instead: ../Account/LogOn/%3faction%3dupdate

I don't want the encoding...

Help?


I think, in this case, you should use

return RedirectToAction("About", "Home", new { sendto = "update" });

You can't use the keyword "action" because it will be consumed by mvc, so I've replaced it with "sendto" instead.


In your controller, name the parameter with the @ sign, as Pawel writes. So

public ActionResult YourAction(string @action)  will work
public ActionResult YourAction(string action)  will fail
0

精彩评论

暂无评论...
验证码 换一张
取 消