Results 1 to 4 of 4

Thread: url parameter into variable3

  1. #1

    Thread Starter
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Resolved 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.

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  3. #3

    Thread Starter
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591
    GREAT!

    That worked perfectly.

    Thanks again !!

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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
  •  



Click Here to Expand Forum to Full Width