Home Dashboard Directory Help
Search

Context.RewritePath disables Session Module in IIS7 by Rooc


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 357248
Opened: 7/22/2008 4:56:53 AM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

When we use a custom UrlRewrite module that does a RewritePath to an existing .aspx file you cannot use the Session Object in that .aspx page by default. The following exception is thrown by IIS7:
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.

Workaround:
Readd the Session Module under a different name in the <system.webServer><modules> collection. (must be removed again in web.configs of sub applications)
Details
Sign in to post a comment.
Posted by Avi Baer on 6/22/2010 at 4:05 PM
On installing Sharepoint 2010 the install completes and when the sharepoint configuration site is accessed I get this:

Error
Another component has already added an HttpSessionState to the context. Please make sure only one session state module should be registered.

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: be2477c7-7c4c-4b1b-9c02-d072fa2221b9

Date and Time: 6/22/

I have a ULS viewer and not even does the correlation ID come up. Any ideas???

Posted by Microsoft on 1/22/2009 at 7:15 AM
This behavior is by design.
Posted by Johnny Ckae on 12/10/2008 at 12:55 PM
I found a workaround to the 'Another component has already added an HttpSessionState to the context. Please make sure only one session state module should be registered.' issue: Add <remove name="Session"/> before the second session module tag.
Posted by xxxa on 11/26/2008 at 2:28 AM
Hi ,
I'm facing this problem too.
I added the Session module as sugested, that works fine , but it causes a problem on pages that do not use RewritePath ( like default.aspx for example)

'Another component has already added an HttpSessionState to the context. Please make sure only one session state module should be registered.'


Any idea what to change?
Posted by Microsoft on 7/24/2008 at 9:00 PM
We were able to reproduce the issue you are seeing. We are escalating this bug to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release
Posted by Microsoft on 7/23/2008 at 4:27 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com/)
Sign in to post a workaround.
Posted by patridge on 8/5/2009 at 12:58 PM
You can also simply remove and re-add the Session module rather than adding it twice (must be in system.webServer\modules):

<system.webServer>
<modules>
<add name="YourRewriteHandler" type="your.handlertype" />
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
</modules>
</system.webServer>