Grab $_GET like in PHP but in Visual Basic?

2020-05-07 04:53发布

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.

2条回答
你好瞎i
2楼-- · 2020-05-07 05:39

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.

查看更多
够拽才男人
3楼-- · 2020-05-07 05:47

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")
查看更多
登录 后发表回答