重写所有 url 将 aspx 扩展名更改为 html
我是 iis url 重写模块的新手,我不知道如何做到这一点。
例如我有这个网址:
http://localhost/section.aspx?x=section1&IDSection=45
我想要这个:
http://localhost/section~x~section11~IDSection~45.html
有什么想法吗? 感谢您的帮助。
I'm new in the iis url rewrite module and i not how to do this.
for example i have this url:
http://localhost/section.aspx?x=section1&IDSection=45
And i want this:
http://localhost/section~x~section11~IDSection~45.html
Any ideas?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(3)
您需要做的是编写一个处理程序。这样您就可以捕获扩展名,然后根据需要对其进行解析。这对用户来说是不可见的。
处理程序绝对是您想要的方式,就好像您使用 URL 路由一样,您仍然需要在 IIS 中将处理程序从 aspx 更改为 html。
What you need to do is write a handler. That way you can capture the extension and then parse it as needed. This will be invisible to the user.
Handler is definitely the way you want to go as if you use URL Routing, you will still need to change the handler from aspx to html in IIS.
这是在 IIS7 中使用 URL 重写模块的解决方案:
this is the solution using URL Rewrite module in IIS7:
您可以在 C# 中执行此操作,以便在 ASP.NET 中的 URL 中使用自定义扩展。
You can do this in c# to use a customized extension in your URL in ASP.NET.