【问题标题】:Routing in native asp.net (not in Asp.NET MVC)本机 asp.net 中的路由(不在 Asp.NET MVC 中)
【发布时间】:2016-04-29 16:29:27
【问题描述】:

不使用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 我如何显示视图或发送的形式

【问题讨论】:

  • 这是一个 mvc 应用吗?你标记了 asp.net-mvc

标签: c# asp.net routing config


【解决方案1】:

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

您需要一个 RouteTable 来注册路由。一个自定义路由处理程序,它将根据 URL 上的值返回实际页面。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-27
    • 2015-02-16
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    相关资源
    最近更新 更多