alex
alex

Reputation: 79

Grab $_GET like in PHP but in Visual Basic?

I have a web browser called WebBrowser1 and I want to be able to detect the $_GET like i would be able to in PHP and place it in a Textlabel

Like if the url was:

www.example.com/page.php?myget=true

Is it possible to Visual Basic to grab what ever is in 'myget'. I'm a bit new at the this so please let me know.

Upvotes: 0

Views: 435

Answers (2)

Andrew Peacock
Andrew Peacock

Reputation: 771

This is assuming you are running a webforms VB.net application.

First you'll need to add a reference to System.Web

Then use the following code to read the querystring from the browser uri and parse it into a collection of name value pairs. If you don't want to include System.Web you could write your own code to do it based on the value of WebBrowser1.Uri.Query

Dim queryString As String = webBrowser1.Url.Query
Dim queryStringValues As NameValueCollection = HttpUtility.ParseQueryString(queryString)
Dim lolValue As String = queryStringValues("lol")

Upvotes: 0

Mark Holland
Mark Holland

Reputation: 846

You probably want:

Request.QueryString("myget") 

for properties on the querystring.

Request.Form() would get you posted params

and Request.Params() will get params from both.

Upvotes: 2

Related Questions