简体   繁体   English

如何在ASP.NET 2.0中重写URL?

[英]How do I rewrite a URL in ASP.NET 2.0?

How do I rewrite URLs in ASP.NET 2.0? 如何在ASP.NET 2.0中重写URL?

I'd like to rewrite the following URL: 我想重写以下网址:

Example : www.example.com/default.aspx?q=india 范例:www.example.com/default.aspx?q = india

To this: 对此:

www.example.com/india www.example.com/india

How do I do that in ASP.NET 2.0? 如何在ASP.NET 2.0中做到这一点?

One way is to use the IIS Rewrite Module . 一种方法是使用IIS重写模块

You can put the re-writes in your web.config for easy maintenance. 您可以将重写内容放入web.config中,以便于维护。 For example: 例如:

<rewriteMap name="/fixurls">
   <add key="/LateOffers.aspx" value="/late-offers" />
</rewriteMap>

I've been successfully using Helicon ISAPI Rewrite ( http://www.isapirewrite.com ) for a while with ASP.NET 2.0. 我已经在ASP.NET 2.0中成功使用Helicon ISAPI Rewrite( http://www.isapirewrite.com )了一段时间。

Note that their 3.0 version is more Apache mod_rewrite compliant. 请注意,它们的3.0版本与Apache mod_rewrite更加兼容。 2.0 has some significant differences. 2.0有一些显着差异。

You can use. 您可以使用。 This is open source url rewriter for .net. 这是.net的开源URL重写器。

http://urlrewriter.net/index.php/support/configuration http://urlrewriter.net/index.php/support/configuration

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

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