How to pass 3 parameters in http post method?

aravindb

New member
Joined
Nov 19, 2013
Messages
3
Programming Experience
1-3
Hi,
I have asp.net with vb web application,in that i need to use http post method with 3 parameters, one of the parametes in byte format.I am new to http post method in server side, i am famler with clint side json method. but to use in server side with 3 parameters.
VB.NET:
            Dim url = "https://testgateway.com"
            Dim client = New WebClient()
            Dim method = "POST"
            Dim parameters = New NameValueCollection()
            parameters.Add("parameter1", stry)
            parameters.Add("parameter2", strJSON)
            parameters.Add("parameter3", aa.ToString) ' This paramete in byte and i passed as string.
            Dim response_data = client.UploadValues(url, method, parameters)
            Dim responseString = UnicodeEncoding.UTF8.GetString(response_data)
I am used above code Is it correct way, but it return "Invalid Request"

Pls help to solve this problem.

Regards,
Aravind
 
Last edited by a moderator:
aa.ToString will always return "System.Byte[]" so that is not it. Maybe you should Convert.ToBase64String, or maybe not. You have to find out what receiver expects, possibly using a web debugger as suggested to see how a correct upload looks like.
 
Hi, Yes ,its base64strig format all 3 parameters, is it coreect way which i passed ? pls reply me , bcz i am not know little bit http post method which look like this.
 
You should know what your own code is doing.

I'm trying to be rude, but if you don't know what your code is doing, how did you manage to write it? If you managed to write it, you should know what it's doing. Right?

No, your parameters are not using encoding.

Documentation : Convert.ToBase64String Method (System)
 

Latest posts

Back
Top