Session state can only be used when enableSessionState is set to true either in a configuration

后端 未结 12 902
[愿得一人]
[愿得一人] 2020-11-29 04:44

I am working on Asp.net MVC 2 app with c# by using vs 2010.I am having below mentioned error when I run my app locally under debug mode.

Error message image is as be

相关标签:
12条回答
  • 2020-11-29 05:07

    Following answer from below given path worked fine.

    I found a solution that worked perfectly! Add the following to web.config:

    <system.webServer>
    <modules>
    <!-- UrlRewriter code here -->
    <remove name="Session" />
    <add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
    </modules>
    </system.webServer>
    

    Hope this helps someone else!

    0 讨论(0)
  • 2020-11-29 05:12

    For SharePoint Can find the web config file in C:\inetpub\wwwroot\wss\VirtualDirectories\Sitecollection port number - and Make changes

     <system.web>
      <pages enableSessionState="true" /> 
     </system.web>
    

    and using SharePoint Management Shell Run below Command

       Enable-SPSessionStateService -DefaultProvision
    
    0 讨论(0)
  • 2020-11-29 05:13

    This error was raised for me because of an unhandled exception thrown in the Public Sub New() (Visual Basic) constructor function of the Web Page in the code behind.

    If you implement the constructor function wrap the code in a Try/Catch statement and see if it solves the problem.

    0 讨论(0)
  • 2020-11-29 05:16

    Session State may be broken if you have the following in Web.Config:

    <httpModules>
      <clear/>
    </httpModules>
    

    If this is the case, you may want to comment out such section, and you won't need any other changes to fix this issue.

    0 讨论(0)
  • 2020-11-29 05:17
    1. Could be your skype intercepting your requests at 80 port, in Skype options uncheck
    2. Or Your IE has connection checked for Proxy when there is no proxy
    3. Or your fiddler could intercept and act as proxy, uncheck it!

    Solves the above problem, It solved mine!

    HydTechie

    0 讨论(0)
  • 2020-11-29 05:22

    I have got this error only when debugging the ASP .Net Application.

    I also had Session["mysession"] kind of variables added into my Watch of Visual Studio.

    the issue was solved Once, I have removed the Session Variables from watch.

    0 讨论(0)
提交回复
热议问题