Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Application_BeginRequest(object sender, EventArgs e)
- {
- //If upper case letters are found in the URL, redirect to lower case URL.
- if (Regex.IsMatch(HttpContext.Current.Request.RawUrl.ToString(), @"[A-Z]") == true)
- {
- if (Request.HttpMethod == "GET" && !(Request.RawUrl.Contains(".axd")))
- {
- string LowercaseURL = HttpContext.Current.Request.RawUrl.ToString().ToLower();
- Response.Clear();
- Response.Status = "301 Moved Permanently";
- Response.AddHeader("Location", LowercaseURL);
- Response.End();
- }
- }
- }
Add Comment
Please, Sign In to add comment