DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   

Resolve "Redundant Hostnames" issue using ASP.NET

By Ashok Nalam on 19 Sep 2015 | Category: ASP.NET | Tagged: global.asax ASP.NET error 
This snippet show how to resolve "Redundant Hostnames" issue using ASP.NET.
  Discuss Add Comment   |  
Add rating Rate this resource   


Today I have recevied a notification in Google Analytics saying "Redundant Hostnames" found for your property Redundant Hostnames means, search engine considers URL's with and (with out WWW and with WWW) differently.

Redundant Names Notification from Analytics

How to Resolve:

To resolve this issue add below code to Global.asax in Application_BeginRequest method.

protected void Application_BeginRequest(object sender, EventArgs e)
        if (HttpContext.Current.Request.Url.ToString().ToLower().Contains(""))
            HttpContext.Current.Response.Status = "301 Redirect";
			ToString().ToLower().Replace("", ""));

From the above code we are replacing with when the request contains

  Discuss Add Comment    
Add rating Rate this resource   
About the Contributor
Member Since : 10 Dec 2012
Member Points (Level) : 9226  (Professional)
Location : INDIA
Home Page :
About : I am admin of this site.
Rate this resource
Add your Comment
Name Email WebSite
Captcha Refresh

Comments (0)
No comments found, click here to add comment.
cheap jordans|wholesale air max|wholesale jordans|wholesale jewelry|wholesale jerseys