I'm trying to include some user credentials for accessing a remote
file (XML File).It can be accesed by dll'method at remote location . The remote location requires that I use Basic authentication. I tried using following code but when code execution comes at highlighted line it breaks itself and nothing happens.
Dim xmlDoc As XmlDocument = New XmlDocument
Dim request As HttpWebRequest = CType(WebRequest.Create("http://www.abc.ds/scripts/web.dll"), HttpWebRequest)
'Set Request Method (POST) and Content Type (text/xml)
request.Method = "POST"
request.ContentType = "text/xml"
request.ContentLength = 100000
request.Credentials = New System.Net.NetworkCredential("Username", "pwd")
request.Timeout = 15000
Dim str As Stream = Nothing
Dim resp As WebResponse = request.GetResponse() str = resp.GetResponseStream()
' Get Response into String
Dim sr As StreamReader = New StreamReader(str)
'label1.text = xmlDoc.InnerXml
Can anyone help?
Thanks in Advance.