开发者

Redirect to handling page

开发者 https://www.devze.com 2023-02-20 11:47 出处:网络
On the masterpage I have menu items links that look like like: <ul><li><a href=type=article&articleId=82>Article 82</a></li></ul>

On the masterpage I have menu items links that look like like:

<ul><li><a href=type=article&articleId=82>Article 82</a></li></ul>

When the link is clicked, I want to navigate to the right aspx page based on the QueryString 'type' (in this case DisplayArticle.aspx) and pass the parameter to it (in this case articleId=82).

How to do it?

Should I create a special Handler page like HandleRequest.aspx, so the menu item would look like:

<ul><li><a href=HandleRequest.aspx?type=article&articleId=82>Artic开发者_开发知识库le 82</a></li></ul>

And then after parsing the QueryString, rediret to a needed page?

Or maybe there is a better approach?


If you can't put in the direct link, use a generic handler (HandleRequest.ashx) and parse your querystrings, yo can then re-use this across your application.

If you are using asp.net MVC, you can use the URL Routing to do something similar which would be cleaner as well.

Good luck

0

精彩评论

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