Question

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?

Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top