|
-
Oct 6th, 2004, 08:58 PM
#1
Thread Starter
Fanatic Member
url parameter into variable3
I have a parameter in my url, for example
page.aspx?param1=100
I would like to take the value of the param1 parameter, and store it into a variable. only i'm not sure how.
how can i get access to the url string in my vb code of my aspx page?
THANKS!
Last edited by drpcken; Oct 8th, 2004 at 07:36 AM.
-
Oct 6th, 2004, 11:08 PM
#2
PowerPoster
VB.NET:
Dim myString as String = Request.QueryString("param1")
Dim myInt as Integer = Integer.Parse(myString)
C#:
string myString = Request.QueryString["param1"];
int myInt = int.Parse(myString);
Those may not be exact syntax, but it will be pretty close.
-
Oct 8th, 2004, 07:36 AM
#3
Thread Starter
Fanatic Member
GREAT!
That worked perfectly.
Thanks again !!
-
Oct 9th, 2004, 12:32 AM
#4
PowerPoster
No problem, be sure to do error checking. If the value doesn't exist, an empty string is returned. If you call integer.parse() on a empty string an error will be thrown.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|