How not to have URLs end with ".aspx"?

Topics: Developer Forum
Sep 29, 2008 at 8:31 PM
Hi,

Is it possible to have pages managed by N2 not end in .aspx?

For example, I prefer going to http://mysite.com/hello-world (without .aspx) rather than http://mysite.com/hello-world.aspx.

Thank you,

-James
Coordinator
Sep 29, 2008 at 9:34 PM
Yes, try this in web.config (you'll need to enable wildcard mappings on IIS)

<host ...>
      <web extension="" />
Sep 30, 2008 at 3:33 PM
Excellent, thank you!
Oct 7, 2008 at 4:38 AM
Edited Oct 7, 2008 at 5:17 AM
As an advice, additionally,

you can use exceptional

Intelligenzia.UrlRewriter (total) - This is a rule based, declarative (in Web.config custom section) url redirector/filtering engine, which can use a RegEx patial matches to locate redirections.

so you can get more of that just respecting you.

I.e.:

url: <site>/images/big/mom
url: <site>/images/big/dad
url: <site>/images/big/<others>

to

<site>/ImageHandler.ashx?section=images&attribute=big&title=mom&file=dc00233-1.jpg
<site>/ImageHandler.ashx?section=images&attribute=big&title=dad&file=dc00234-1.jpg
<site>/ImageHandler.ashx?section=images&attribute=big&title=who%2dcares&file=<others>.jpg