有没有办法让TempData存储在浏览器的cookie而不是Session State中.我的网站上禁用了会话状态.
谢谢.
Nazaf,
试试这个删除你的cookies:
public void DeleteCookie(string name)
{
DateTime now = DateTime.UtcNow;
string cookieKey = name;
var cookie = new HttpCookie(cookieKey,null)
{
Expires = now.AddDays(-1)
};
HttpContext.Response.Cookies.Set(cookie);
}
用法:
DeleteCookie("__ControllerTempData");
原文链接:https://www.f2er.com/aspnet/245378.html