繁体   English   中英

在本机asp.net中路由(不在Asp.NET MVC中)

[英]Routing in native asp.net (not in Asp.NET MVC)

如何不使用mvc来实现asp.net路由

例如,这是我的本地主机http:// localhost /

我有user.aspx页面

http://localhost/user.aspx

我如何获得以下URL来路由到此user.aspx页上的不同功能?

http:// localhost / user / example1

http:// localhost / user / example1 / setting

http:// localhost / user / example1 / setting / changeImage

http:// localhost / user / example1 / setting / enableView

http:// localhost / user / example1 / security

http:// localhost / user / example / message / view

http:// localhost / user / example / message / send

当用户请求此路径http:// localhost / user / example / message / viewhttp:// localhost / user / example / message / send时,重要的问题是如何显示视图或发送表单

很久以前,我尝试使用IIS的RouteTable和URLRewriterExtension进行相同的操作。 在这里写了一篇关于它的博客文章。

您将需要一个RouteTable来注册路由。 一个定制的Route处理程序,它将基于URL上的值返回实际页面。

您也可以从MSDN Code下载工作示例。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM