• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

ASP.NET, clear session variable when leaving page

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    As an aside I seem to remember you can place ViewState in memory / database / file on the server - create a custom Grid and ovveride the specific event that saves the viewstate and handle accordingly.

    Dont know if that really solves the problem though
    Vieze Oude Man

    Comment


      #12
      What would be wrong with clearing it in Global_AcquireRequestState when the request is for a page it is not required on ?

      Comment


        #13
        Would not work for when the user navigates away to another site though.

        Comment


          #14
          Agreed - I never use DataSets. Custom business objects offer a much more OO aproach and can be easily generated by a variety of template based code generators. I like Rockford Lhotkas approach:

          http://www.lhotka.net

          ViewState is potentially very dodgy if you have a variety of connection speeds bewteen you and your users.... its a shame its often required for events but I tend to write custom controls (especially DataGrids) that automatically turn off viewstate for the individual Controls created by the grid (absolutley dozens of em) but still supports ItemCommand events and Custom Paging, which is all you really need. Output caching, data caching etc all help where appropriate.

          The pages served by the current application I have written the framework for are typically 12-14k including images and viewstate. a 20 minute session timeout means even if they dissapear off to visit eBay at lunchtime the application still scales. Ram for a web server in a farm is cheap. The database is invariably the bottleneck unless it is well configured and maintained.
          Vieze Oude Man

          Comment


            #15
            Originally posted by cswd
            Aye I use Lhotka's approach albeit using it somewhat before I was aware of his work. On that matter, I am selling Lhotka's Expert C# business objects here if anyone is interested btw:

            http://cgi.ebay.co.uk/ws/eBayISAPI.d...tem=9704256289

            This is one book that is NOT toilet paper.

            Regarding ViewState -- that's for windows forms type functionality - NOT for general web use.
            What a shameless plug. Though I have put a bid on.

            Comment


              #16
              "Regarding ViewState -- that's for windows forms type functionality - NOT for general web use" - that's a curious comment!

              been using lhotka [although decreasingly], since middle/late nineties. he must have breathed a sigh of relief when microsoft came up with the .not model and put an end to his attempts to force stateful objects into a web environment. overnight, they became the de facto standard. and his expert c# bus. objects shows a more balanced approach to the matter.
              but the original post referred to a dataview and so i assumed that datasets were implicit in his design.

              but come on mcgd - you are desparate to show us some of your stuff. post up your solution to this trivial problem...i'd be keen to see it, esp after having largely dumped base class/inheritance a couple of years ago in the web environment. i understand that .not2 might do a better job of it.

              Comment


                #17
                Might well do when I have the time... its in VB.Net mind. Might port a generic version to C# as of course it is the property of my client...

                And its part of a complete framework of Custom Web Controls, base classes, Custome User Controls, hosts for dynically creating wizard-style interfaces based on XML meta data etc... it not an approach to a single page that needs to clear Session state when someone goes elsewhere....
                Last edited by mcquiggd; 29 March 2006, 17:41.
                Vieze Oude Man

                Comment

                Working...
                X