UrlRewriting.Net Module + IIS7 Equals Page.User == null?

I used the UrlRewriting.Net module for a couple of years without any problems in Windows XP and Windows 2003. I recently upgraded my home computer to Windows 7 and started developing a new website.

The plan was to use the .html extensions and rewrite them in their .aspx copies using the UrlRewriting.Net module. Everything works flawlessly in VWD 2008 , but when I try to run it through IIS7, this is a completely different story.

When I try to access a page through .html rewrite, I can no longer access Page.User; he keeps returning null. If I click on a page using the .aspx extension, the .User page fills correctly. I should also mention that I have a LoginView controller on my main page and it experiences the same symptoms: when accessed via the .html extension, it shows AnonyousTemplate; When using the .aspx extension, it correctly displays the LoggedInTemplate. I assume that they are related to each other.

[Note. I also tried URLs without links and they show the same problem]

The only way I worked was to switch the application pool to Classic, which then requires me to add the ASP.Net ddl handler for the .html extension [otherwise it is processed by StaticFileHandler and appears as a 404 error]. However, I would like my web application to work correctly for people without having to deal with IIS.

So, I have a few questions left:

  • Does anyone have any ideas as to why Page.User is always zero for .html => .aspx rewritten pages?
  • Why does it work in VWD 2008, but not IIS7?
  • What has changed from IIS6 => IIS7 that could cause this?
  • Any other thoughts on workarounds?

[Note: I just tried to rewrite .aspx => .aspx and did not find a problem. Not quite what I want, but thought I should mention it.]

+5
3

UrlRewriting.Net. IIS7:

<modules runAllManagedModulesForAllRequests="true">

"runAllManagedModulesForAllRequests", , , , .

+11

, , , , , , " ASP.NET ". web.config:


<system.webServer>
  <modules>
    <remove name="Session" />
    <add name="SessionManualAdd" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </modules>
</system.webServer>

, , Session '*.htm', HttpContext.RewritePath, .

. , Microsoft :

http://connect.microsoft.com/VisualStudio/feedback/details/357248/context-rewritepath-disables-session-module-in-iis7

+2

Microsoft ( URL- ) 1 Win7 Windows Server 2008 R2: http://www.microsoft.com/download/en/details.aspx?id=5842

: http://support.microsoft.com/kb/980368

ASP.NET 4 URL- . , HttpModules, . HttpModules URL- . , HttpModule, .aspx, , HttpContext.Session.

1 (SP1) web.config, auth URL- , / asp.net ..

I don't know if this fixes something for rewriting for static file extensions like .htm. I think probably not. I would try to avoid setting runAllManagedModulesForAllRequests = "true" in production environments as it adds extra overhead to static file requests.

0
source

All Articles