Return to Snippet

Revision: 31075
at August 28, 2010 22:02 by Fogh


Initial Code
if (HttpContext.Current.Request.Url.ToString().ToLower().StartsWith("http://www"))
{
    Response.Redirect("http://WEBSITE.COM" + HttpContext.Current.Request.RawUrl.ToString());
}

Initial URL

                                

Initial Description
Add this code to your Global.asax in your ASP.NET project, in the \"Application_BeginRequest\" event.

Initial Title
Redirect to website without www.

Initial Tags
url, aspnet

Initial Language
C#