I have this xmlhttp post how do I use this in vb.net.

I have the below asp code that works but I need to get it over to vb.net. How would I accomplish this?
Set xmlhttp = server.createobject("MSXML2.ServerXMLHttp")
xmlhttp.open "POST","http://192.168.150.10/AttachDoc_URL/GenAttachDoc.asp", True
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
	xmlhttp.setTimeouts 10000,10000,30000,60000
	strRequest = "URL="& URL & "&" & AdditionalInfo
	xmlhttp.send Replace(strRequest," ","")
	xmlhttp.waitForResponse 1

Open in new window

-cr-Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PaulHewsCommented:
Import the System.Net namespace.
Dim Req As HttpWebRequest
        Req = CType(WebRequest.Create("http://192.168.150.10/AttachDoc_URL/GenAttachDoc.asp"), HttpWebRequest)  'Correct login URL
        Req.Method = "POST"
        Req.ContentType = "application/x-www-form-urlencoded"
 
        Dim PostData() As Byte = System.Text.Encoding.Default.GetBytes("URL=" & URL & "&" & AdditionalInfo)
        Req.GetRequestStream.Write(PostData, 0, PostData.Length)
        Req.GetRequestStream.Close()
 
        Dim resp As HttpWebResponse = CType(Req.GetResponse, HttpWebResponse)
 
        Dim sr As New System.IO.StreamReader(resp.GetResponseStream)
 
        Dim ResponseText As String = sr.ReadToEnd
        Debug.WriteLine(ResponseText)
        sr.Dispose()
        resp.Close()

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vb_jonasCommented:
I use this:
Imports System.Net
 
    Public Function ReadDataSetFromXMLurl(ByVal url As String) As DataSet
 
        Dim request As HttpWebRequest
        Dim response As HttpWebResponse = Nothing
        Dim ds As DataSet
 
        Try
            request = DirectCast(WebRequest.Create(url), HttpWebRequest)
            request.Timeout = 60 * 1000 
            response = DirectCast(request.GetResponse(), HttpWebResponse)
            ds = New DataSet()
            ds.ReadXml(response.GetResponseStream())
        Finally
            If Not response Is Nothing Then response.Close()
        End Try
 
        Return ds
 
    End Function

Open in new window

0
-cr-Author Commented:
If a username and password are required how would I do that using the above examples?
0
vb_jonasCommented:
Hi!

Add:
Dim cred As New NetworkCredential(username,password) ' and ,domain if needed
request.Credantials=cred

before .GetResponse()
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.