0

My application has a custom HTTPModule for handling friendly URLs. And here is the modules section of the web.config file.

<modules>
<remove name="ScriptModule"/>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition=""/>
<add name="NHibernateSessionModule" type="MyApp.Core.NHibernateBase.NHibernateSessionModule"/>
<add name="ApplicationModule" type="MyApp.ApplicationModule"/>
<add name="URLDispatcher" type="MyApp.URLDispatcher"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>

The module also has logic to handle error pages. The problem that I have now is when a request with a url ending with '.' is sent to the server, none of my modules are triggered and the user sees the default asp.net 404 page.

Not sure what's happening and how to redirect the users to my custom 404 page.

I did find another question related to this, and the solution provided was to use one of the .Net 4 specific configuration tag in the web.config file. At the moment I am not in a position to move to .Net 4. So, I am looking for a different solution. Any suggestions?

Kumar
  • 113
  • 1
  • 10

1 Answers1

0

I guess you are using http redirection for friendly urls.

If the application is under IIS7 , please check that you have installed the following feature:

Control Panel --> Progams --> Turn off windows features --> World wide web Services --> Common HTTP Features –> HTTP Redirection

And then you need to config your custom http module not only in

<system.web>
    <httpModules>
        <add name="CustomModule" type="NameSpace.ClassName, AssemblyName" />
    </httpModules>
</system.web>

but also in

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <add name="CustomHttpModule" type="NameSpace.ClassName" />
    </modules>
</system.webServer>
keep fool
  • 101
  • 4