开发者

Problem with ASP.NET MVC 2 Routing

开发者 https://www.devze.com 2023-02-06 19:12 出处:网络
I have the following URL: http://localhost/PagingController/ShowPage?pageNumber=3 When user clicks this link he must be redirected to the following URL:

I have the following URL:

http://localhost/PagingController/ShowPage?pageNumber=3

When user clicks this link he must be redirected to the following URL:

http://localhost/MyController/ MyAction?pageNumber=3

How can I create a开发者_如何学Python mapping rule for these URLs? I don't understand how to get pageNumber parameter with URL templates such as .../{controller}/{action}

Thanks.


You don't have to define a route for it. If you use querystring, you can just get it in the action like this:

public ActionResult MyAction(int pageNumber)
0

精彩评论

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