ASP.NET Masters: What are the advantages / disadvantages of using Session variables?

后端 未结 8 1534
一生所求
一生所求 2020-12-08 02:58

I\'ve done a search on this subject already, and have found the same data over and over-- a review of the three different types of sessions. (InProc, Sql, StateServer) Howev

8条回答
  •  执念已碎
    2020-12-08 03:24

    You should be judicious in your use of Session, since multiple requests to the same Session object will usually be queued: see "Concurrent requests and session state" http://msdn.microsoft.com/en-us/library/ms178581.aspx.

    Note that you can set EnableSessionState to ReadOnly to allow concurrent read access to session state.

    This queuing is a good thing, as it means developers can use Session without being concerned about synchronization.

    I would not agree with your colleague's recommendation to "never" use Session and I certainly wouldn't consider rolling my own.

提交回复
热议问题