Reputation: 10367
Say, I want to have a page whose URL is "/about", not "/about.aspx". How would I go about doing this, using Microsoft Visual Studio 2010? I read some stuff about RewriteRules in ISS but I wasn't sure how to configure it.
Upvotes: 2
Views: 98
Reputation: 2675
If you only have a few pages, you can use a url map rewrite rule in Web.config
:
<system.webServer>
<rewrite>
<rules>
<rule name="url map rewrite rule" enabled="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{urlmap:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="true" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="urlmap">
<add key="/" value="default.aspx" />
<add key="/about" value="about.aspx" />
<add key="/contactus" value="contact.aspx" />
etc.
etc.
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
Upvotes: 3
Reputation: 100547
The other option is to use MVC instead of Web Forms for your site. This way all urls will have no .aspx at the end.
Upvotes: 4