Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variable issue

Status
Not open for further replies.

cosmoh2o

Programmer
Jul 22, 2002
92
US
I have built a web application with Visual Studio using C# and a small sample of the code looks like the following:

private string isbn; // at class level
private int total;

on_page_load() {
if (!IsPostback) {
if (Session["ISBN"] != null && Session["total"] != null) {
this.isbn = Convert.ToString(Session["ISBN"]);
this.total = Convert.ToInt32(Session["total"]);
}

}
}

The session variables are stored "InProc" and the page is transfered from main.aspx (after storing Session["ISBN"] = "9-999-9-9" and Session["total"] = 1) via Server.Transfer("new_page.aspx").

When the user "clicks" a button on this page the isbn and total values are displayed. Sometimes the isbn value is correct, sometimes it is not. The total value always has the correct value. Has anybody out there ran into this same kind of problem? If so, what did you do to solve it. I have been thinking that there may be issues with the way the "Convert" object translates the Session object to a string value versus an integer value but am unsure. Any help/hints would be great. Thanks to anybody that can help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top