Link to home
Start Free TrialLog in
Avatar of -cr-
-cr-

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start 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
 
        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

Avatar of -cr-
-cr-

ASKER

If a username and password are required how would I do that using the above examples?
Hi!

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

before .GetResponse()