How Can My Server Program Read The Variables Sent Using A Http 'get' Request Method In Vb.net?
I have written server code in vb.Net. I want it to read to variables sent by another server's HTTP 'GET' request. For example the first server will send this URL http://localhost/s
Solution 1:
You can get them from the Context.Request.QueryString object:
mySender = Context.Request.QueryString("sender").ToString
This assumes the code you are running on your server is running under IIS. I notice the call is to a .PHP page and wonder how you are actually getting the url to the server running the VB code.
If this is simply processing the URL as a string, then the following should handle it for you:
Dim tempArray AsString()
Dim tempValuePairs AsString()
Dim tempPair AsString()
Dim tempValue AsStringDim tempString AsString
tempArray = sRequest.Split(CChar("?"))
If tempArray.Length <> 2Then'url not validReturnEndIf
tempValuePairs = tempArray(1).Split(CChar("&"))
ForEach tempString In tempValuePairs
tempPair = tempString.Split(CChar("="))
tempValue = tempPair(1)
'check for pair name, tempvalue will contain dataSelectCase tempPair(0).ToLower
Case"sender"
mySender = tempValue
Case"receiver"Case"msgdata"Case"recvtime"Case"msgid"CaseElseEndSelectNext
Post a Comment for "How Can My Server Program Read The Variables Sent Using A Http 'get' Request Method In Vb.net?"