MrAgile
asked on
Friendly URLS in MVC 2 application
Hi There,
I would like to find out the best way to render friendly URLS in my MVC 2 application. Can anyone post some code for this.
I'm wanting a url like http://www.mydomain.com/some-folder/some-file.aspx.
Thanks in advance,
Sean
Sean,
MVC does provide user-friendly urls by default. So the MVC url might look something like:
http://site.com/product/edit/123
as against
http://site.com/EditProduct.aspx?id=123
The second one is how WebForms do it. Another benefit of the first one is that search engines can cache these urls, but not the latter one. I'm sure you agree that something like:
http://site.com/products/display/laptops
is a lot more intuitive than
http://site.com/DisplayProducts.aspx?id=72
So, I'm not sure what exactly you mean by user-friendly urls. Please explain.
Arun
MVC does provide user-friendly urls by default. So the MVC url might look something like:
http://site.com/product/edit/123
as against
http://site.com/EditProduct.aspx?id=123
The second one is how WebForms do it. Another benefit of the first one is that search engines can cache these urls, but not the latter one. I'm sure you agree that something like:
http://site.com/products/display/laptops
is a lot more intuitive than
http://site.com/DisplayProducts.aspx?id=72
So, I'm not sure what exactly you mean by user-friendly urls. Please explain.
Arun
ASKER
Hi Nmarun, looking for seo friendly urls in particular. Something like mydomain.com/my-folder/my- page/
Does this make sense?
Does this make sense?
Dear MrAgile:
when i go to the link you mentioned, i get 404 error and the page redirects again
404.png
when i go to the link you mentioned, i get 404 error and the page redirects again
404.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Arun,
The link I gave you was just in the format I required. Thanks for the links above, that's exactly what I was after.
Sean
The link I gave you was just in the format I required. Thanks for the links above, that's exactly what I was after.
Sean
do you mean that you want to handle the error page 404, and display it in a nice way?
if so you can follow many methods
1.setting it up in IIS
http://ask.enquiro.com/2008/how-to-create-a-custom-404-error-page-in-microsoft-iis/
2. in Asp.net
http://geekswithblogs.net/shahed/archive/2007/10/23/116278.aspx
3. ASP mvc
http://www.genericerror.com/blog/2009/01/27/ASPNetMVCCustomErrorPages.aspx
http://www.techdreams.org/microsoft/aspnet/how-to-fix-404-errors-of-aspnet-mvc-website-deployed-on-iis-6-windows-server-2003/2572-20090515
hope it helps