Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: asp.net session state


Message #1 by "Bry Pickett" <bryp@g...> on Sat, 16 Jun 2001 19:13:40
Hi all,



Does anyone know at what event session state becomes available?  I'm 

trying to access Context.Session in the Application_AuthenticateRequest 

event but an error says "session state not available in the current 

context".



thanks in advance



Message #2 by "Yackson mata" <yackson.mata@v...> on Mon, 18 Jun 2001 17:48:23 +0200

Hi all,

  here code source of Session available



 <%@ Language=VB EnableSessionState=true %>

<html>

   <head>

      <script runat=server>

         Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

              ' Obtain DataTable of User's Personal Stock Data

              Dim MyStocks as DataTable

              Set MyStocks = Session("PersonalStockData")

              ' Update HTML Output with Session Values

              Name.Value = Session("FirstName")

              FavPet.Value = Session("FavoritePetName")

              Foreach Stock in MyStocks.Rows

            StockList.AddItem(Stock.Symbol & ": " & Stock.Name)

              Next

         End Sub

      </script>

   </head>

   <body>

      Hi <span id="Name" runat=server/>, your pet is: <span id="FavPet"

runat=server/>.

      Here are the stocks you and your pet currently own:

      <acme:listbox id="StockList" runat=server>

         <! ? List Box will be dynamically populated from code -->

      </acme:listbox>

   </body>

</html>



Regards



WWW.veneca.com

Yackson mata



Message #3 by "Bry Pickett" <bryp@g...> on Mon, 18 Jun 2001 22:49:17
Thanks for this response.  I'm aware you can get to session state in 

Page_Load.  



I'd like to know if session state is available 'further up the request 

pipeline' (ie, before the Page_Load event).  If so, which event?



Thanks.













> 

> Hi all,

>   here code source of Session available

> 

>  <%@ Language=VB EnableSessionState=true %>

> <html>

>    <head>

>       <script runat=server>

>          Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

>               ' Obtain DataTable of User's Personal Stock Data

>               Dim MyStocks as DataTable

>               Set MyStocks = Session("PersonalStockData")

>               ' Update HTML Output with Session Values

>               Name.Value = Session("FirstName")

>               FavPet.Value = Session("FavoritePetName")

>               Foreach Stock in MyStocks.Rows

>             StockList.AddItem(Stock.Symbol & ": " & Stock.Name)

>               Next

>          End Sub

>       </script>

>    </head>

>    <body>

>       Hi <span id="Name" runat=server/>, your pet is: <span id="FavPet"

> runat=server/>.

>       Here are the stocks you and your pet currently own:

>       <acme:listbox id="StockList" runat=server>

>          <! ? List Box will be dynamically populated from code -->

>       </acme:listbox>

>    </body>

> </html>

> 

> Regards

> 

> WWW.veneca.com

> Yackson mata

> 

Message #4 by "George Saliba" <georges@c...> on Mon, 18 Jun 2001 15:39:09 -0700
Try Session_OnStart in your global.asax file i think.



George Saliba



-----Original Message-----

From: Bry Pickett [mailto:bryp@g...]

Sent: Monday, June 18, 2001 3:49 PM

To: ASP+

Subject: [aspx] RE: asp.net session state





Thanks for this response.  I'm aware you can get to session state in

Page_Load. 



I'd like to know if session state is available 'further up the request

pipeline' (ie, before the Page_Load event).  If so, which event?



Thanks.













>

> Hi all,

>   here code source of Session available

>

>  <%@ Language=3DVB EnableSessionState=3Dtrue %>

> <html>

>    <head>

>       <script runat=3Dserver>

>          Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

>               ' Obtain DataTable of User's Personal Stock Data

>               Dim MyStocks as DataTable

>               Set MyStocks =3D Session("PersonalStockData")

>               ' Update HTML Output with Session Values

>               Name.Value =3D Session("FirstName")

>               FavPet.Value =3D Session("FavoritePetName")

>               Foreach Stock in MyStocks.Rows

>             StockList.AddItem(Stock.Symbol & ": " & Stock.Name)

>               Next

>          End Sub

>       </script>

>    </head>

>    <body>

>       Hi <span id=3D"Name" runat=3Dserver/>, your pet is: <span

id=3D"FavPet"

> runat=3Dserver/>.

>       Here are the stocks you and your pet currently own:

>       <acme:listbox id=3D"StockList" runat=3Dserver>

>          <! - List Box will be dynamically populated from code -->

>       </acme:listbox>

>    </body>

> </html>

>

> Regards

>

> WWW.veneca.com

> Yackson mata

>=20
Message #5 by "Thomas Tomiczek" <t.tomiczek@t...> on Wed, 20 Jun 2001 11:36:56 +0200
George,



This event is fired when the session is CREATED, not when a page is

requested.



On the original request, he wanted to READ the session data WHILE

ASP.Net is in the handling of a Page request BEFORE the page is actually

requested.



Bry, I have the same problem. It looks like not, sadly. The

Authentificator seems to fire before the session module has initialized

the session into the request's context.



Regards



Thomas



-----Original Message-----

From: George Saliba [mailto:georges@c...]

Sent: Dienstag, 19. Juni 2001 00:39

To: ASP+

Subject: [aspx] RE: asp.net session state



Try Session_OnStart in your global.asax file i think.



George Saliba



-----Original Message-----

From: Bry Pickett [mailto:bryp@g...]

Sent: Monday, June 18, 2001 3:49 PM

To: ASP+

Subject: [aspx] RE: asp.net session state





Thanks for this response.  I'm aware you can get to session state in

Page_Load. 



I'd like to know if session state is available 'further up the request

pipeline' (ie, before the Page_Load event).  If so, which event?



Thanks.



Message #6 by "Bry Pickett" <bryp@g...> on Thu, 21 Jun 2001 03:13:29
Thomas, thanks for the input.  Another option for user state. I'm looking 

at persisting user state in a session cookie, then on each request, 

pulling state out of the cookie and into the Context.Items collection.  

Context.Items is available, I think, till the request ends and seems to be 

a possible solution as our user session info is limited, but I could see 

this growing into a large pain if we're not careful.  The other 

alternative is SQL Server out of proc.  Any thoughts?  Comments?  BTW - 

have you seen a good resource that details the exact events (and order) 

for a request?







> George,

> 

> This event is fired when the session is CREATED, not when a page is

> requested.

> 

> On the original request, he wanted to READ the session data WHILE

> ASP.Net is in the handling of a Page request BEFORE the page is actually

> requested.

> 

> Bry, I have the same problem. It looks like not, sadly. The

> Authentificator seems to fire before the session module has initialized

> the session into the request's context.

> 

> Regards

> 

> Thomas

> 

> -----Original Message-----

> From: George Saliba [mailto:georges@c...]

> Sent: Dienstag, 19. Juni 2001 00:39

> To: ASP+

> Subject: [aspx] RE: asp.net session state

> 

> Try Session_OnStart in your global.asax file i think.

> 

> George Saliba

> 

> -----Original Message-----

> From: Bry Pickett [mailto:bryp@g...]

> Sent: Monday, June 18, 2001 3:49 PM

> To: ASP+

> Subject: [aspx] RE: asp.net session state

> 

> 

> Thanks for this response.  I'm aware you can get to session state in

> Page_Load. 

> 

> I'd like to know if session state is available 'further up the request

> pipeline' (ie, before the Page_Load event).  If so, which event?

> 

> Thanks.

> 

Message #7 by "Juan T. Llibre" <j.llibre@c...> on Thu, 21 Jun 2001 08:23:47 -0400
It seems to me that authentication HAS 

to occur before a web request is served.



Otherwise...why authenticate ?



Bry is, apparently, looking for an event after the page 

has been requested, and the user has been authenticated,

but before the page is loaded.



I haven't checked it out...but maybe OnInit ?

( if used within a control... )



regards,





Juan

===



----- Original Message ----- 

From: "Thomas Tomiczek" <t.tomiczek@t...>

To: "ASP+" <aspx@p...>

Sent: Wednesday, June 20, 2001 5:36 AM

Subject: [aspx] RE: asp.net session state





George,



This event is fired when the session is CREATED, not when a page is

requested.



On the original request, he wanted to READ the session data WHILE

ASP.Net is in the handling of a Page request BEFORE the page is actually

requested.



Bry, I have the same problem. It looks like not, sadly. The

Authentificator seems to fire before the session module has initialized

the session into the request's context.



Regards



Thomas



-----Original Message-----

From: George Saliba [mailto:georges@c...] 

Sent: Dienstag, 19. Juni 2001 00:39

To: ASP+

Subject: [aspx] RE: asp.net session state



Try Session_OnStart in your global.asax file i think.



George Saliba



-----Original Message-----

From: Bry Pickett [mailto:bryp@g...]

Sent: Monday, June 18, 2001 3:49 PM

To: ASP+

Subject: [aspx] RE: asp.net session state





Thanks for this response.  I'm aware you can get to session state in 

Page_Load.  



I'd like to know if session state is available 'further up the request 

pipeline' (ie, before the Page_Load event).  If so, which event?



Thanks.




  Return to Index