Make session readonly on asp.net programmatically (EnableSessionState=“ReadOnly”)

前端 未结 2 1424
难免孤独
难免孤独 2020-12-19 06:59

I need to make the session readonly so I can establish multiple requests to a page that uses sessions variables but in the readonly mode.

Since all the process are p

2条回答
  •  抹茶落季
    2020-12-19 07:26

    In your scenario there must be one page who can write on session and other have no right to write on it. page that has session-state write access will hold a writer lock on the session until the request finishes. A page gains write access to the session state by setting the EnableSessionState attribute on the @Page directive to True. A page that has session-state read access for example, when the EnableSessionState attribute is set to ReadOnly, will hold a reader lock on the session until the request finishes.

    <% @Page EnableSessionState="ReadOnly" %>
    

    for more information you can read this link.

提交回复
热议问题