string usersig = Session["USERID"].ToString(); Pricer VFPPricer = new Pricer(); decimal YourPrice = VFPPricer.GetPrice(usersig, quantity, color); VFPPricer = null; cmdSave.Enabled = true;Here is the code I call in the pages OnInit code to see if the user has logged in. If it is null, I redirect them to a login page, then pass the page to return to as a parameter.
if(Session["USERID"] == null) { Response.Redirect("Logon.aspx?ReturnTo=" + PageName + ".aspx"); }The code to set the session variable is
Session.Add("USERID", e.UserID);
What is happening here is that the user has entered all of the data, pressed the price button, the click event fires, the VFP dll loads, the session gets wiped out, the page is resubmitted after servicing the click event, we hit the onInit, the session is null, we redirect to the logon, they log in again, we go back to the order form, which now sees the !IsPostback as true, which repaints the form as a new post, which wipes out the request data the user has already entered.