3

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?

Karthikeyan
  • 2,548
  • 14
  • 82
  • 142

1 Answers1

1

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?

Falak Mahmood
  • 17,298
  • 2
  • 40
  • 67
  • 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 04 '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 04 '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 06 '12 at 11:35
  • AFAIK, it is not possible without placing an another request. – Falak Mahmood Jun 07 '12 at 06:59