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

Posted on 2011-10-18
Last Modified: 2012-08-13
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

Question by:knowlton
    LVL 20

    Accepted Solution

    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:

    LVL 5

    Author Closing Comment

    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!

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now