Last post Dec 11, 2012 12:38 PM by IgorDR
Sep 19, 2012 03:02 AM|vickyguptajecrc|LINK
Our old site was in Joomla and now we have developed a new site in .Net 2.0
We have to do 301 redirects of old site url to respective new URL's . Please advise how can achieve this, we have more than 100+ pages for which we have to do 301 redirect.
We have placed code in global.asax but it lead to stopping ajax controls. we are on godaddy shared hosting. Please help. Thanks
Sep 19, 2012 04:54 AM|interwanderer1|LINK
How about this:
Sep 19, 2012 05:18 AM|vickyguptajecrc|LINK
Thanks for reply. Actually the old site was in Joomla and New site is in .Net. So what we have to do is if user request for old url , it will take him automatically to the new URL for example if user request for www.example.com/warranty , it will lead him
automatically to www.example.com/test/warranty.aspx
We have around 198 URL needs to be redirect so SEO would not be affected. We have placed following code for the 301 redirection in global.asax file:
#region 301 redirect
if (Request.Url != null)
// 301-redirect for Page 1 to Page 2
//string xmlpath = ConfigurationManager.AppSettings["ReadXml"];
string xmlpath = HttpContext.Current.Request.PhysicalApplicationPath + "xml/301redirect.xml";
DataSet ds = new DataSet();
DataRow dr = ds.Tables["URLS"].Select("OldURL='" + Request.Url.ToString().ToLower() + "'");
if (dr.Length > 0)
string URLOLD = dr["OldURL"].ToString();
string NewUrl = dr["NewURL"].ToString();
string key = URLOLD;
key = key.ToLower();
if (Request.Url.ToString().ToLower().Contains(key) == true)
Response.Status = "301 Moved Permanently";
string urlChkForLower = Context.Request.RawUrl;
if (Regex.IsMatch(urlChkForLower, @"[A-Z]") == true)
Context.Response.Status = "301 Moved Permanently";
But by applying this , the Ajax controls in website stopped working. How to solve it or is there any other way to implement?
Oct 22, 2012 10:25 AM|vijay_myl|LINK
Refer the below link to handle redirect to new url ........
Oct 29, 2012 12:23 PM|ozkary|LINK
You can use the HttpRedirect settings using IIS7. This requires admin access to the web server.
You can also use a HTTP module instead of using global.asax for better performance. The module is configured on your web config and it can applied your URL redirect rules. Cache your rules in memory to avoid database access overhead.
Dec 11, 2012 12:38 PM|IgorDR|LINK
If using IIS 7 or higher, the simplest solution I found is to use the httpRedirect element in my web.config. I wrote a small article here:
ASP.NET 301 permanent redirects: the best solution