我遇到了问题, 我在web.config中设置了会话时间
<system.web>
<sessionState timeout="60" mode="InProc" />
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
</system.web>
在我的控制器中
public ActionResult CreateBrand()
{
Session.Timeout=60;
Purchase purchase = Session["purchaseItem"] as Purchase;
if (purchase!=null && purchase.Brand != null)
{
return View(purchase.Brand);
}
return View();
}
答案 0 :(得分:1)
你实际上从未问过一个问题,所以我会猜测你在问什么......
<sessionState timeout="60" mode="InProc" />
当mode="InProc"
时,设置timeout="60"
通常不会将会话超时延长超过20分钟,因为应用程序池将在20分钟后失效(默认情况下)。
没有应用程序池=没有进程=没有会话。
更改应用程序池设置或使用其他会话状态提供程序。