By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

HTTPS connection...any ideas?

P: n/a
I'm trying to write code to connect to a place on the net, send them an
xml file, and get one in return. I've pieced together the following
code, and was wondering if anyone can tell me if I'm on the right track
or not.

In particular, if anyone knows, am I supposed to the ContentType to
something like "xml"?

Dim netCred As New System.Net.NetworkCredential(_
"username", "password")
Dim cCache As New System.Net.CredentialCache

cCache.Add(New Uri(_
""), _
"Basic", netCred)
' Now, we need an actual request object,
' and set some properties of it...
Dim request As System.Net.HttpWebRequest
request = System.Net.HttpWebRequest.Create( _
request.Credentials = cCache
request.Method = "POST"

' Do we need to set content type to something like xml?
' How do we do that?
request.ContentType = "???"

' then how do we send it?
Dim writer As System.IO.StreamWriter
writer = New System.IO.StreamWriter(request.GetRequestStream)
writer.Write("The XML Document")

' Now we need to read what they responded with...
' is this asynchronous?
Dim resp As System.Net.HttpWebResponse
resp = request.GetResponse()
Dim reader As New System.IO.StreamReader(resp.GetResponseStream())
Dim sReponse As String = reader.ReadToEnd()

Thanks for any pointers that anyone can give me -- I'm completely
flying blind here...


Feb 9 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.