sessionstatebehaviour.readonly允许我将值写入会话 [英] sessionstatebehaviour.readonly allowing me to write value into session

查看:105
本文介绍了sessionstatebehaviour.readonly允许我将值写入会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

why sessionstatebehaviour.readonly allowing me to write value into session as below without any error

<pre lang="sql">[SessionState(SessionStateBehavior.ReadOnly)]
  public class TestController : Controller
  {
      //
      // GET: /Test/

      public ActionResult Index()
      {
          Session[&quot;vd&quot;] = &quot;cs&quot;;</pre>

推荐答案

请参阅以下链接它没有错误,但同时它不会在请求结束时保持会话中的值。



http://stackoverflow.com/questions/8939188/writing-to-a-read -only-session-in-mvc-3 [ ^ ]



http://stackoverflow.com/questions/12263086/controller-sessionstatebehavior-is-readonly-and-i-can-update-会话变量 [ ^ ]
Refer below link it does not error out but same time it will not persist the value in session at end of request.

http://stackoverflow.com/questions/8939188/writing-to-a-read-only-session-in-mvc-3[^]

http://stackoverflow.com/questions/12263086/controller-sessionstatebehavior-is-readonly-and-i-can-update-session-variable[^]


这篇关于sessionstatebehaviour.readonly允许我将值写入会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆