UrlRewriteModule.net and session problem

I have a problem in asp.net web application.

I use UrlRewritingNet.UrlRewrite and it only works fine when there is no session usage on the page.

for example: a simple Default.aspx page with the code:

<% Session["some_value"] = "test"; %>

If I contact him through the address

http://somesite.net/Default.aspx 

it's ok but if i try

http://somesite.net/test/

i has an error:

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.

How can I solve this problem?

UPD: I found the answer here

just add two lines to web.config

<system.webServer>
    <modules>

      <remove name="Session"/>
      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

    </modules>
</system.webServer>
+3
source share
1 answer

I found the answer here

just add two lines to web.config

<system.webServer>
    <modules>

      <remove name="Session"/>
      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

    </modules>
</system.webServer>
+4
source

Source: https://habr.com/ru/post/1715595/


All Articles