asp.net mvc 4 - Deployment Issue: (MVC4 HotTowel SPA) -
I have developed a web application using VS2012 MVC 4 (Hot Towel SPA). If I run it through Visual Studio then it works fine. But when I put it on the IIS server, I'm getting an exception.
My server is server server 2008 R2 and IIS version 7.5. All dependencies are installed.
Due to code section error:
On index.cshtml page if if (session ["user"] == faucet)
Load Load Login (Login.cshtml) Load the Home View if the session is not zero. Everything is working fine while walking through the visual studio. If I remove the check of the session then the home page is loaded successfully. But I have to check the session before going home. But I get the following exception:
Object references are not set for an example of an object.
Description: An uncontrolled exception occurred during the execution of the current Web request. Please review the stack trace for more information about the error and where the code originated from it.
Exception Description: System.NullReferenceException: The object reference is not set for an example of an object.
line 65:
}
line 66: @if (session ["user"] == tap) line 67: {line 68: @ html.party ("login ")
I've got a solution to my problem just by this module my web Add to the .config file.
& lt; Configuration & gt; ... & lt; System.webServer & gt; ... & lt; Module & gt; & Lt; Remove name = "session" /> & Lt; Add name = "session" type = "System.Web.SessionState.SessionStateModule" /> ... & lt; / Module & gt; & Lt; /system.webServer> & Lt; / Configuration & gt;
It is very strange that Microsoft added this module to the template.