1
我正在寻找一种方法来以编程方式打开和关闭asp.net中的会话。session_write_close相当于asp.net(以编程方式禁用和启用会话)
在php中,通过使用:session_write_close
然后session_start
函数来重新启用它,可以轻松实现。
我正在寻找一种方法来以编程方式打开和关闭asp.net中的会话。session_write_close相当于asp.net(以编程方式禁用和启用会话)
在php中,通过使用:session_write_close
然后session_start
函数来重新启用它,可以轻松实现。
这是不可能的.NET低于4
在ASP.NET 4.0中,您可以使用此类似的代码,启用和禁用会话:
HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Default);
* Default: passing this means that everything works as before (ie, you control session through the @page directive or the <pages> entry in the web.config file);
* Required: session state is enabled for read/write access;
* ReadOnly: gives access to read only session state;
* Disabled: turns off session state for the current request.
7年后,我不知道如果说有什么改变了吗?它似乎没有......我仍然无法找到任何真正模仿php的`session_write_close`的方法。 – David784 2018-03-07 16:40:53