Share via

webclient response

OSVBNET 1,401 Reputation points
2022-07-25T17:48:52.35+00:00

Hello,
Using:
https://learn.microsoft.com/en-us/dotnet/api/system.net.webclient.uploadvalues?view=net-6.0

UpClient.Encoding = Encoding.UTF8
Dim MyResponse As Byte() = UpClient.UploadValues("http://www.domain.com/form.php", FormFields)
MsgBox(Encoding.ASCII.GetString(MyResponse))

I always get an empty string, am I doing it wrong or it's normal and I should disregard the return value of UploadValues?

Also as I set the webclient's encoding to UTF8 (for non ascii chars in form fields) should I check the server response:
Encoding.ASCII.GetString(MyResponse)
or
Encoding.UTF8.GetString(MyResponse)

Thanks all

Developer technologies | VB
0 comments No comments

Answer accepted by question author

Jiachen Li-MSFT 34,241 Reputation points Microsoft External Staff
2022-07-27T07:55:46.033+00:00

Hi @OSVBNET ,
WebClient.UploadValues Method returns a Byte array containing the body of the response from the resource, so it dependes on if http://www.domain.com/form.php provide the return value and what encoding it returns.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.