capturing variables

C

Carlos

Hi all,

this question is probably trivial, but I just need to know
how to capture a variable name, and its value when it is
being passed from a URL address...i.e. if I have
http://www.mysite.com?myvar=itsvalue
Then I would be able to process such variable in my code
behind logic. is this type of variable called session variable in the asp
jargon?

Thanks,

Carlos.
 
K

Ken Cox [Microsoft MVP]

Hi Carlos,

In that case, the variable is being passed on the querystring. You can pick
it up in ASP.NET and store it in a variable like this:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim strVar As String = ""
If Not IsNothing(Request.QueryString("myvar")) Then
strVar = Request.QueryString("myvar")
End If
Response.Write(strVar)
End Sub

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top