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","", 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

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.

Import the System.Net namespace.
Dim Req As HttpWebRequest
        Req = CType(WebRequest.Create(""), 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)
        Dim resp As HttpWebResponse = CType(Req.GetResponse, HttpWebResponse)
        Dim sr As New System.IO.StreamReader(resp.GetResponseStream)
        Dim ResponseText As String = sr.ReadToEnd

Open in new window


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
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
            request = DirectCast(WebRequest.Create(url), HttpWebRequest)
            request.Timeout = 60 * 1000 
            response = DirectCast(request.GetResponse(), HttpWebResponse)
            ds = New DataSet()
            If Not response Is Nothing Then response.Close()
        End Try
        Return ds
    End Function

Open in new window

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

Dim cred As New NetworkCredential(username,password) ' and ,domain if needed

before .GetResponse()
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

From novice to tech pro — start learning today.