I am currently supporting an application running on SharePoint 2007 and have run in to a problem with the order of httpModules.

I've written a module that initiates context needed by our role provider and it needs access to the address of the current web to do that. This is not a problem when handling normal page requests since I can look at the Url in the request object. But the SPRequest module rewrites this for service calls (e.g http://dev.local/sites/page/_layouts... becomes http://dev.local/_layouts...) and I no longer have access to the original url.

So what I'm looking for is a good way to either position my module before SPRequest in web.config (SPWebConfigModifications does not allow you to specify position as far as I'm aware) or some other way of retrieving the original requested url during the BeginRequest event.

Modules section of web.config

    <clear />
    <!-- This is where I would like to place a custom module -->
    <add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
    <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
    <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
    <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
    <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
    <add name="RoleManager" type="System.Web.Security.RoleManagerModule" />

Was hoping that it would be possible to insert this when creating the SP application by using .config extensions but was once again unable to find a way to insert at a specific location.

  • How is your web.config look like? – Falak Mahmood Feb 19 '14 at 10:43
  • Added the module section to the question – nimatt Feb 19 '14 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.