Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
Actually i wanted to invoke some POST method of Web api .
In that post method --- i have to send a file with multiple other parameter

how can i invoke POST method of web api along with other parameter.
in web api ----- its separate -separate 4 parameter with datatype (stream , string , long, long)

What I have tried:

Dim URL As String = strWebApiURL ' "FILE_URL_PATH"
               Dim webClient As WebClient = New WebClient()
               Dim formData As System.Collections.Specialized.NameValueCollection = New System.Collections.Specialized.NameValueCollection()
               formData("filestream") = ""
               formData("filename") = "2"
               formData("ulpMembershipId") = "3"
               formData("mobileNumber") = "4"
               formData("createdBy") = "5"
               formData("idProofType") = "63"
               webClient.Headers.Add("Authorization", BasicAuth)
               Dim responseBytes() As Byte = webClient.UploadValues(URL, "POST", formData)
               Dim Result As String = System.Text.Encoding.UTF8.GetString(responseBytes)
Posted
Updated 4-Jan-18 20:47pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900