Results 1 to 7 of 7

Thread: [RESOLVED] Very basic Session State Question

  1. #1

    Thread Starter
    Hyperactive Member maikeru-sama's Avatar
    Join Date
    May 2008
    Posts
    339

    Resolved [RESOLVED] Very basic Session State Question

    In my Web.config file, I don't have a "sessionstate" element coded, which means I am using the default Session State which is InProc.

    I am using Forms Authentication and once the the user is validated, I create a Ticket and Cookie programmically so I can stick some custom data in the Cookie.

    I don't use Session Variables of any kind in my Web Application.

    Can I simply turn off Session State or are there other things I need to take into consideration before I do this?

    For example, if I turned off SessionState, when a user forgets to enter a required field on a Web Form and submits the Web Form, would the data they entered previously still be saved in or would I now have to handle this like you had to in Classic ASP?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Very basic Session State Question

    Quote Originally Posted by maikeru-sama View Post
    For example, if I turned off SessionState, when a user forgets to enter a required field on a Web Form and submits the Web Form, would the data they entered previously still be saved in or would I now have to handle this like you had to in Classic ASP?
    What you are referring to here is maintained in the ViewState of your application. Have you also turned this feature off?

    I believe I am correct in saying that you would turn off ViewState before SessionState, as SessionState is quite well optimized.

    Is there a specific reason why you feel you need to turn off SessionState?

    Gary

  3. #3

    Thread Starter
    Hyperactive Member maikeru-sama's Avatar
    Join Date
    May 2008
    Posts
    339

    Re: Very basic Session State Question

    Hi gep13.

    I don't think there is a reason to turn off SessionState but I am not sure I need it to be on.

    I am just trying to make sure I understand all the nuances of the Application I wrote and make sure I understand why I am doing something. I read a few articles that said that SessionState does take up some memory on the Server, which probably isn't a big deal for my Application but I figured if I don't need it on, why have it on, that is why I am trying to understand the concept a little more.

    Is SessionState On only for when you use Session Variables

    No, I have not turned off ViewState but I didn't know if it worked hand and hand with SessionState. I thought maybe if you turn off SessionState, you are also turning off ViewState.

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Very basic Session State Question

    Hey,

    From what I am aware, there is some amount of coupling between ViewState and SessionState, for instance, if the Session times out, then the ViewState will be reset. However, as far as I am aware, turns off SessionState, does not impact ViewState, as the ViewState is written into the content that is sent to the client in a hidden field.

    SessionState needs to be turned on in order to use Session Variables, yes, and also in order to access the Session Application Events, such as Session_Start and Session_End.

    It is one of those things that you will likely use at some point, so I would be tempted to say leave it on.

    Gary

  5. #5

    Thread Starter
    Hyperactive Member maikeru-sama's Avatar
    Join Date
    May 2008
    Posts
    339

    Re: Very basic Session State Question

    Thanks Gep.

    The Applications is 90% complete, which is I why I was a little surprised I hadn't thought about this issue.

    I have purposely stayed away from Sessions on this Project and don't foresee any need to use them or their Events, so I am going to turn Session State Off for now as I believe that if you don't need it, it is better to just turn it off.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Very basic Session State Question

    Hey,

    Sounds like a plan, it is a simple thing to turn back on again

    Gary

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] Very basic Session State Question

    A few things, pay attention chaps:

    1) Session state doesn't affect viewstate. Viewstate is in the HTML source of the page, sessions are maintained via a cookie on the user's machine and an object in memory holding the corresponding data.
    2) The "need" to turn sessions off - You're forgetting one of the fundamental tenets of programming: If it ain't broken, don't fix it. In your discourse, you're attempting to answer a question that nobody is asking. Not using sessions isn't going to increase server load. Turning sessions off isn't going to increase server load. You have therefore accomplished nothing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width