Intelliwins Blog

Anything you wanna know about?

Seo Friendly URL Redirection On Asp.net Web Forms

by Admin 21. September 2013 14:06
On Asp.net 3.5 sp1 onward microsoft has given facility for URL Routing . You just have to include few codes into Global.asax. After URL Routing Your URL Will look more human and search engine friendly. If you URL is www.example.com/page.aspx?id=about  it will look like www.example.com/page/about . Extension less and SEO Friendly . For that we have to add Global.asax into our project . Then import System.Web.Routing   <%@ Import Namespace="System.Web.Routing" %>  Then we have to write code for URL redirection inside Global.asax.   void registerroute(RouteCollection routes) { routes.MapPageRoute( "Home-Route", "Home", "~/Default.aspx" ); }  This is for Static Pages with out query strings. For Webpages with query string like www.example.com/page.aspx?id=about   The code would be: routes.MapPageRoute( "Page-Route", "Pages/{page}", "~/page.aspx" );The New Seo Friendly URL looks like www.example.com/pages/about To access the attached query string string pg = Page.RouteData.Values["page"] as string; Hope this will solve one of the biggest headache for Asp.net web forms . Happy Coding !!!!  

Tags: , ,

Asp.net | Url redirection

Brit Colony, Bhubaneswar,India +91 94384 80191 info@ intelliwins.com

About Us

Intelliwins mission is to alter the dynamics of the software industry by providing trusted, supportive and quality software development servies to clients that view our partnership as a strategic driver for their success.

Newsletter

Enter your email to join our mailing list