C# 会话丢失它';ASP.NET MVC 5中的间歇
您看到会话间歇性丢失其值的原因了吗C# 会话丢失它';ASP.NET MVC 5中的间歇,c#,asp.net-mvc-5,C#,Asp.net Mvc 5,您看到会话间歇性丢失其值的原因了吗 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
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.
}
<sessionState mode="SQLServer"
cookieless="true "
regenerateExpiredSessionId="true "
timeout="30"
sqlConnectionString="Data Source=MySqlServer;Integrated Security=SSPI;"
stateNetworkTimeout="30"/>
附加信息-“a”是未使用的变量。不确定这是否是原因。嗨,谢谢你的信息。我还没有把它说清楚。所以我想它会采用默认设置。