Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Wants to convert the SharePoint requests to Lowercase in the IIS processing pipe line, it should not invoke additional request to change/convert the requested URL into lowercase but the same request should be converted.

The below IIS Rewrite Rule converts the URL which needs an additional request:

< rules>
< rule name="Convert to lower case" stopProcessing="false">
< match url=".[A-Z]." ignoreCase="false"/>
< conditions>
< add input="{URL}" negate="true" pattern="*lb-live.aspx$"/>
< /conditions>
< action type="redirect" url="{ToLower:{R:0}}" redirectType="Permanent"/>
< /rule>

Is there a way to simply convert the case while the request is being processed in IIS pipeline?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This requirement is very specific to your project. You can fulfil it by writing a HTTP Module which intercepts every SharePoint request, and converts it to Lowercase, see below:

public void Init(System.Web.HttpApplication Appl)
        {
            //Hookup the function that does the lowercase
            Appl.BeginRequest += new EventHandler(Appl_BeginRequest);
        }

void Appl_BeginRequest(object sender, EventArgs e)
        {
            System.Web.HttpApplication myAppl = (System.Web.HttpApplication)sender;
            string requestUrl = myAppl.Request.Url.PathAndQuery.ToLower();

            //additional checks on url
            if (requestUrl.Contains("test"))
            {

            }
        }

For addtional help, please see this link: Support for URL rewriting?

share|improve this answer
    
Is that mean that we can simply change the case while the request is in the IIS pipeline?...have gone through many articles however seems that we can only change and place a new request using the "Rewrite" method...? –  Karthikeyan Jun 4 '12 at 13:52
    
Every request goes through Application_BeginRequest anyway. You'll need to add some logic there. see my updated response. –  Falak Mahmood Jun 4 '12 at 14:21
    
thanks for the code sample. Simply wants to convert the case on the IIS Request pipeline, how Could I achieve this without a redirection or placing another request... –  Karthikeyan Jun 6 '12 at 11:35
    
AFAIK, it is not possible without placing an another request. –  Falak Mahmood Jun 7 '12 at 6:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.