how to add querystring values with RedirectToAction method?

前端 未结 4 1221
野的像风
野的像风 2020-12-03 00:28

In asp.net mvc, I am using this code:

RedirectToAction(\"myActionName\");

I want to pass some values via the querystring, how do I do that?

4条回答
  •  無奈伤痛
    2020-12-03 01:07

    Do not make the same mistake I was making. I was handling 404 errors and wanted to redirect with 404=filename in the querystring, i.e. mysite.com?404=nonExistentFile.txt.

    QueryString Keys cannot begin with numbers. Changing from 404 to FileNotFound solved my issue, i.e. mysite.com?FileNotFound=nonExistentFile.txt.

提交回复
热议问题