开发者

Equivalent Url Rewrite in .NET?

I'm from a LAMP background. I'm trying to come up with a .NET equivalent for the following .htaccess file

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^(.*)\/?$ $1.php?%1 [L]

In the php world, I just put this code into a .htaccess file that sits in my web root. Then each of the following urls http://mysite.com/helloworld, http://mysite.com/helloworld.php, and http://mysite.com/helloworld?param=5 and http://mysite.com/helloworld.php?param=5 resolve to the page helloworld.php, with the latter two having the $_GET['param'] populated. How d开发者_如何学Pythono I achieve the same results in the .Net world with aspx pages?

I am using ASP.NET web forms.

Thanks


You either download and install the UrlRewrite 2.0 HttpModule manually from www.iis.net, or use the Web Platform Installer (WPI) to install it. Personally, I prefer WPI.

Grab the WPI from here: http://www.microsoft.com/web/downloads/platform.aspx

It will let you install and configure all aspects of your Windows Web development environment.

-Oisin

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜