Posted By

Fogh on 08/28/10


Tagged

url aspnet Globalasax


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Redirect to website without www.


 / Published in: C#
 

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

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

Report this snippet  

You need to login to post a comment.