How to use personalized urls in mvc application

How to use personalized urls in mvc application

I am working on a website in which many users can create their account and have a personalized page. I wish to provide them a twitter like url to access their pages, for example or . I am using mvc 1.0. I have an understand that i can add routes to the global.asax file, but i am not able to figure out how to add a route that will work for such urls.

Please provide some help / suggestions. Thanks. file upload with URL rewrite enabled


Empty Resources Cache, provided by SQLResourceProvider
Well, you must always add this as a last route:. Sending data to server (ASP.NET MVC) with Ajax(jQuery) through JSON
routes.MapRoute(     "Default",     "{profile}",     new { controller = "Profile", action = "Index" } ); 
although this will make your app more cumberany . How to get the Url for urlAction helper class?Specifically, you'll have to check usernames so this they don't collide with the rest of your routes (like /info, '/admin' etc.).. calling a jquery function from mvc action What I recommend is to move personalization page one level deeper:. How to register javascript in ASP.NET MVC action?
routes.MapRoute(     "Default",     "profile/{username}",     new { controller = "Profile", action = "Index" } ); 
Can I deny access to a Wordpress directory with MVC 2?Why won't my MVC project work after publishing it?


For my part, I would use the following, placed after all another routes, although befare a catchall:.
routes.MapRoute(      "PrettyProfile",      "{username}",      new { controller = "Profile", action = "Index" }  );  
As Anton says, you have to constrain your userIDs not to clash with your another routes..

62 out of 100 based on 37 user ratings 252 reviews