I'd really like to shift one of my projects to MVC, but I'm curious about the URL Rewriting. I currently use the UrlRewriting.Net dll for friendly URLs in my ASP.NET Project. So I'm adding stuff like this to my web.config:
The good news is that you really don't need urlrewriting. the new routing engine removes the file based urls and virtual urls is baked into the system. Take a look at some of the blog post about the url routing on ScottGu blog and others. If you still
have questions post back.
Marked as answer by Haacked on Dec 14, 2007 04:35 PM
One thing to keep in mind is that url rewriting actually rewrites the URL from the perspective of ASP.NET.
The MVC framework doesn't do rewriting, it does routing. The URL never changes. I'd agree with jcteaque, url rewriting is probably unecessary with MVC. If you have an old URL you wish to support and map to a new url, you could probably model it with a Route.
Phil Haack (http://haacked.com/)
Senior Program Manager, Microsoft
reteep
Participant
874 Points
196 Posts
Question about Co-Existance and UrlRewriting.Net
Dec 14, 2007 10:40 AM|LINK
I'd really like to shift one of my projects to MVC, but I'm curious about the URL Rewriting. I currently use the UrlRewriting.Net dll for friendly URLs in my ASP.NET Project. So I'm adding stuff like this to my web.config:
<add virtualUrl="^~/Profil/(.*)/Games/Plattform/(.*)/Seite/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Profil.aspx?u=$1&do=Games&sys=$2&p=$3" ignoreCase="true" />
If I add MVC now and use the new URL Controllers - does anyone already have some experience if both will be able to co-exist?
Thanks!
jcteague
Member
211 Points
45 Posts
Re: Question about Co-Existance and UrlRewriting.Net
Dec 14, 2007 03:14 PM|LINK
The good news is that you really don't need urlrewriting. the new routing engine removes the file based urls and virtual urls is baked into the system. Take a look at some of the blog post about the url routing on ScottGu blog and others. If you still have questions post back.
Haacked
Contributor
6901 Points
412 Posts
Re: Question about Co-Existance and UrlRewriting.Net
Dec 14, 2007 04:34 PM|LINK
One thing to keep in mind is that url rewriting actually rewrites the URL from the perspective of ASP.NET.
The MVC framework doesn't do rewriting, it does routing. The URL never changes. I'd agree with jcteaque, url rewriting is probably unecessary with MVC. If you have an old URL you wish to support and map to a new url, you could probably model it with a Route.
Senior Program Manager, Microsoft
What wouldn’t you do for a Klondike bar?
reteep
Participant
874 Points
196 Posts
Re: Question about Co-Existance and UrlRewriting.Net
Dec 15, 2007 08:44 AM|LINK
Sounds great, thanks!