Force URL to lowercase for all request

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
12/21/2010 9:34:22 AM
Gravatar
Total Posts 15
kamran

Force URL to lowercase for all request

Hi

Im trying to make all request of mojoport base site to lowercase  in Global.ascx.

 protected void Application_BeginRequest(Object sender, EventArgs e)
{

string lowercaseURL = (Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.Url.AbsolutePath);

if (Regex.IsMatch(lowercaseURL, @"[A-Z]"))
 {
 lowercaseURL = lowercaseURL.ToLower() + HttpContext.Current.Request.Url.Query;
 
 Response.Clear();
 Response.Status = "301 Moved Permanently";
 Response.AddHeader("Location", lowercaseURL);
 Response.End();
 }

}

But Implementing the above the friendly URL are not working and Default pageid is shown in every Request.please provide some information how this can be implemented

Regards

kamran

 

 

7/22/2011 2:27:46 AM
Gravatar
Total Posts 2

Re: Force URL to lowercase for all request

Hi i hava tried implementing the above code

protected void Application_BeginRequest(object sender, EventArgs e)
        {
                       string lowercaseURL = (Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.Url.AbsolutePath);
            if(Regex.IsMatch(lowercaseURL,@"[A-Z]"))
            {
                lowercaseURL = lowercaseURL.ToLower() + HttpContext.Current.Request.Url.Query;

                Response.Clear();
                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", lowercaseURL);
                Response.End();
            }
        }

it is working well in visual studio on my computer but when i host it on my server in godaddy its not working . can any one help me

 

You must sign in to post in the forums. This thread is closed to new posts.