Reputation: 69
Do you see a reason why the session loses it's value intermittently?
public ActionResult Index(string app) // this view hits the Create Controller on a form post event
{
Session["appType"] = app;
return View();
}
[HttpPost]
public ActionResult Create(string userName, string password)
{
string a = Session["appType"].ToString(); // throws object reference error.
}
Upvotes: 1
Views: 244
Reputation: 872
You'll see code like:
<sessionState mode="SQLServer"
cookieless="true "
regenerateExpiredSessionId="true "
timeout="30"
sqlConnectionString="Data Source=MySqlServer;Integrated Security=SSPI;"
stateNetworkTimeout="30"/>
Upvotes: 2