I write a code for make Url in Lowercase in global.asax file. my ajax call not working.
it returns me html insted of my result. can any one help me
if I remove the rule from global.asax then it works.
Can any one help me.
Thanks in advance
What I have tried:
This is my ajax call function in aspx page
$.ajax({
type:"POST",
url: siteRoot+"default.aspx/getSearchResult",
contentType: "application/json",
data: JSON.stringify({
searchBox: request.term,
}),
success: function (data) {
}
This is my URL Rule in global.asax file
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Regex.IsMatch(HttpContext.Current.Request.Url.ToString(), @"[A-Z]"))
{
// Lowercase url
String lower = HttpContext.Current.Request.Url.ToString().ToLower();
// Redefine response
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location", lower);
HttpContext.Current.Response.End();
}
}