Geeks With Blogs
CodeCanvas .Net Vijay shankar ganesh on everything (well, almost) tech

Recently was trying out the new urlMappings options of asp.net v2 framework. Though the concept is old and it has been beaten to death through various implementations, it is heartening to see finally the framework is providing a inbuilt solution. But the catch is that the overall support for url mapping is very basic, for instead you cannot use wildcard or regex expressions for url substitution which means you will have to figure out a way to manually enter all the possible mappings.

One more headache which I came across when trying to use url mapping is that it does not allow you to provide mappedUrl's which point to anchored names. For instance if I want to map ~/Category/Car.aspx to ~/Categories.aspx#Car it wont work coz the framework is trying to validate the availability of file named "Categories.aspx#Car" ... duhh!. One workaround I employed for this is to provide a redirection page which will then redirect the user to the proper location;
For example lets take the above example, I create a new Redirect.aspx which just does a Response.Redirect(Request["TargetUrl"]) in the Page_Load and in the mappedUrl section I have provided the url as ~/Redirect.aspx?TargetUrl=/Categories.aspx#Car

The drawback with this approach is that the client should have allowed automatic redirection and also you have to make sure that the redirector page is not used for any other phishing purpose.

Posted on Monday, January 23, 2006 12:59 PM DotNet | Back to top


Comments on this post: UrlMappings a Boon or a Pain in the neck?

# Dringend, Wichtig - Very Urgently - Very Important
Requesting Gravatar...
Die beste Online Poker Seite - 100 Euro Gratis

The best Online Poker Room - 100 Euro free

Jackpot: 2.387.534 Euro

http://www.onlinepoker.de

www.onlinepoker.de

internet-poker.de





Das beste Online Casino Europas - 100 Euro Gratis

The best Online Casino - 100 Euro free

Jackpot: 3.457.223 Euro

http://www.onlinekasino.de

www.onlinekasino.de


--
Left by markuslisqe on Jan 24, 2009 5:42 AM

# re: UrlMappings a Boon or a Pain in the neck?
Requesting Gravatar...
I was just thinking about Boon or a Pain in the neck and you've really helped out. Thanks!
Left by Hand Surgeon on Jun 25, 2009 2:43 AM

# re: UrlMappings a Boon or a Pain in the neck?
Requesting Gravatar...
Good post, but have you thought about Pain in the neck before?
Left by carpal tunnel syndrome on Jun 25, 2009 2:53 AM

# re: UrlMappings a Boon or a Pain in the neck?
Requesting Gravatar...
Wow, I never knew that Pain in the neck. That's pretty interesting...
Left by carpal tunnel surgery on Jun 25, 2009 3:13 AM

Your comment:
 (will show your gravatar)


Copyright © CodeCanvas | Powered by: GeeksWithBlogs.net