• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

The Session var getting set in my web service does not seem to stick

In my web service I am setting a Session var Session["USERINFO"]

But when I go back into the web form later....and it loads the data from Session["USERINFO"] -- it is the OLD data not the new data.

Why might that be?

        [WebMethod(EnableSession = true)]
        public string UpdateExistingUser(string tbPassword, string tbPasswordConfirm, string tbFirstName, string tbLastName, string tbAddress1, string tbAddress2, string tbCity, string BillingState, string tbZip, string tbShipFirstName, string tbShipAddress1, string tbShipAddress2, string tbShipCity, string ShippingState, string ShippingCountry, string tbShipZip, string tbEmail, string tbDayPhone, string tbNightPhone, string BillingCountry, string tbShipInstructions, string CheckBoxCopyBillToShip, string cbEmailOptIn)
        {
            string status = "failed";

            List<object> parmspassedback = new List<object>();

            DataTable dt = new DataTable();
            DataTable dtafter = new DataTable();

            dt = null;

            dt = Session["USERINFO"] as DataTable;
                        
            parmspassedback = GlobalMethods.UpdateExistingUser(tbPassword, tbPasswordConfirm, tbFirstName, tbLastName, tbLastName, tbAddress2, tbCity, BillingState, tbZip, tbShipFirstName, tbShipAddress1, tbShipAddress2, tbShipCity, ShippingState, ShippingCountry, tbShipZip, tbEmail, tbDayPhone, tbNightPhone, BillingCountry, tbShipInstructions, CheckBoxCopyBillToShip, cbEmailOptIn, dt, "");

            dtafter = ((DataTable)parmspassedback[1]);

            Session["USERINFO"] = null;

            if (dtafter != null)
            {
                Session["USERINFO"] = dtafter;
            }

            return parmspassedback[0] as string;
        }//end of web method

Open in new window

0
Tom Knowlton
Asked:
Tom Knowlton
1 Solution
 
ddayx10Commented:
Its been awhile since I tested this all the way through but I believe in your web service if you interact with your session in this way it will work:

Context.Session["USERINFO"]
0
 
Tom KnowltonWeb developerAuthor Commented:
As it turns-out, I think I was okay.  The symptoms made me think it was the Session variable, but further investigation revealed a problem with saving the changes.

Anywho, thanks for your time!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now