Passing Variable in VB2005 Web Application

i have created a web application using VB2005, i have stored date in one variable that i created in one page but when trying to access that variable in another page using request.querystring the variable return blank. Below is the code i am using

Page1.aspx
Response.Write(username)--saving the data from the variable
Response.Redirect(HyperLink1.NavigateUrl)--calling Page2.aspx

Page2.aspx
Dim username As String = Request.QueryString("username")
Response.Write(username)
[514 byte] By [mvuyelwam] at [2007-11-20 11:54:52]
# 1 Re: Passing Variable in VB2005 Web Application
You are not actually "saving" that variable anywhere, you are simply writing it to the response stream (or browser). QueryString relies on variables encoded in the address, for example: http://www.crgits.com/test.aspx?myVar=hello

QueryString could now be called from text.aspx to find the value for "myVar".

A quick fix for your problem would be:

Response.Redirect(HyperLink1.NavigateUrl & "?username=" & Server.UrlEncode(username))

Take some time to read about how to pass variables between pages in a stateless web environment using .NET: http://msdn2.microsoft.com/en-us/library/6c3yckfw.aspx
Craig Gemmill at 2007-11-10 3:08:05 >