Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
  2. {
  3. string currentUrl = HttpContext.Current.Request.Path.ToLower();
  4. if(currentUrl.StartsWith("http://mydomain"))
  5. {
  6. Response.Status = "301 Moved Permanently";
  7. Response.AddHeader("Location", currentUrl.Replace("http://mydomain", "http://www.mydomain"));
  8. Response.End();
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement