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
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!
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
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.
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.
Solves the above problem, It solved mine!
HydTechie
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.