0

I created a QueryStringModule based on the one found here: https://stackoverflow.com/questions/6157150/mvc3-encrypted-querystring-parameters

It works fine when I run my web application with the VS2010 debugger, but it is not taken into account when I access my web application through WebMatrix.

Here is how I register it in the system.web section of my Web.config file:

<httpModules>
  <add name="QueryStringModule" type="MyProject.Lib.HttpModules.QueryStringModule" />
</httpModules>

Any clue on why WebMatrix would not use my QueryStringModule? My web site is an ASP.Net MVC 3 project using EF 4.1.

Community
  • 1
  • 1
Jean-François Beauchamp
  • 5,485
  • 8
  • 43
  • 77

1 Answers1

2

WebMatrix uses IIS Express 7.5 server and by default it runs in "Integrated" pipeline mode (In WebMatrix site settings you can see ".NET 4 (Integrated)" ). You have following two options

Option-1: Keep your web.config file as is (i.e. classic mode http module registration) and change the pipeline mode to Classic

  1. Open your site in WebMatrix
  2. Naviagate to site settings in webMatrix
  3. Change .Net Framework version as shown below

enter image description here

Option-2: Don't change the site's pipeline mode, but update web.config file to register HTTP module in integrated mode (your web.config should look something like below). Take a look at http://msdn.microsoft.com/en-us/library/ms227673.aspx#Y873 to learn more about http module registration.

<configuration>
  <system.webServer>
    <modules>
       <add name="QueryStringModule" type="MyProject.Lib.HttpModules.QueryStringModule" />
    </modules>
  </system.webServer>
</configuration>
vikomall
  • 17,379
  • 6
  • 49
  • 39
  • In option 2, you are showing me a Web.config file portion that is the same as the one I posted. I have that in my Web.config file, but it is not working. Am I missing something? – Jean-François Beauchamp Aug 25 '11 at 05:52
  • It is not same... Your config file contains "httpModules" element instead of "modules" and also I am assuming that your config file contains "system.server", instead of "system.webServer". – vikomall Aug 25 '11 at 14:29
  • Great! It is working. I hadn't notice the differences you are pointing out. My file already had the system.webServer secion, but its modules subsection was empty. – Jean-François Beauchamp Aug 25 '11 at 20:46