<ou have to add your MyFieldName=myvalue to the POST's body (separated by a & if you already have data there)
(sorry don't know the proper syntax for .net)
Main Topics
Browse All TopicsI am using the following code to HTTPS post an xml file to third party server. Now I believe I am able to send the file correctly but I need to pass a HTML input field value of type hidden as well with it. If I use a simple HTML interface as shown below I am successful:
<form enctype="multipart/form-da
<input type="hidden" name="MyFieldName" value="myvalue">
<input type="file" name="Myfile">
<br/>
<input type="submit">
</form>
I want to simulate the exact thing in my .NET code. I am confused how to pass value of the hidden field “MyFieldName” along with the file as I am using the WebClient.UploadFile() function. I tried passing it as query string but it does not work.
Can you please suggest something, I am now desperate.
Following is the code i am using at the moment in .NET:
Private Sub testHTTPPostXmlDoc()
Try
Dim web As New System.Net.WebClient()
web.Headers.Add("Content-T
' Simulating the line <input type="hidden" name="MyFieldName" value="myvalue">
web.QueryString.Add("MyFie
Dim res As Byte() = web.UploadFile("https://my
Dim response As String = System.Text.Encoding.ASCII
Catch webEx As WebException
MsgBox(webEx.Message, MsgBoxStyle.Information, "Debug Msg")
MsgBox(webEx.StackTrace, MsgBoxStyle.Information, "Debug Msg")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Debug Msg")
MsgBox(ex.StackTrace, MsgBoxStyle.Information, "Debug Msg")
End Try
End Sub
I BELIEVE THE ISSUE IS BECAUSE OF THE SSL CERTIFICATE. AS I AM POSTING TO HTTPS RATHER THAN HTTP, I THINK I NEED TO ENCRYPT THE DATA SOMEHOW.
CAN YOU PLEASE ASSIST. AS WHEN I DO POST FROM HTML PAGE IT WORKS FINE BUT I BELIEVE THE WEB BROWSER ENCRYPTS THE DATA REQUESTING THE CERTIFICATE PUBLIC KEY. HOW CAN I IMPLEMENT THE SAME IN MY CODE?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: imranbuchhPosted on 2007-04-05 at 18:59:10ID: 18862119
Hello,
Its a 500 point question .. Pump your points .. Need help...
I checked when i use my browser a digital certificate gets saved in the browser certificates as it is an https url. Do i need to export that certificate from my browser and use it somehow ... Any ideas ...
Cheers,
Imran.