AJAX and State Maintenance

  • Thread starter Thread starter Scott McNair
  • Start date Start date
S

Scott McNair

I'm using VS2008 with the built-in "Atlas" AJAX controls. I've got a class
entitled WebAccount which stores a user's credentials (UserID, email, etc);
however it loses its information every time AJAX issues a post. What's the
easiest way to maintain state so that I don't lose this information?

Regards,
Scott
 
Session object.
You can do
Session["webaccount"] = myWebAccount;
WebAccount myWebAccount = Session["webaccount"];



George.
 
well, you can try but what will actually work is :

Session["webaccount"] = myWebAccount;
WebAccount myWebAccount = Session["webaccount"] as WebAccount;


George said:
Session object.
You can do
Session["webaccount"] = myWebAccount;
WebAccount myWebAccount = Session["webaccount"];



George.

Scott McNair said:
I'm using VS2008 with the built-in "Atlas" AJAX controls. I've got a
class
entitled WebAccount which stores a user's credentials (UserID, email,
etc);
however it loses its information every time AJAX issues a post. What's
the
easiest way to maintain state so that I don't lose this information?

Regards,
Scott
 
well, you can try but what will actually work is :

Session["webaccount"] = myWebAccount;
WebAccount myWebAccount = Session["webaccount"] as WebAccount;

Thanks, that did the trick.

I'd actually tried the Session object, but it wasn't working for me. Turns
out it was a simple "Page.IsPostBack" that I wasn't trapping for. D'oh is
me!
 
Back
Top