Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
Is WebDav client is required for downloading files from a website using WebDav protocol.I am tring to download files from a website with proper credentials using web dav but it is not working please help
Posted
Updated 10-Nov-11 0:27am
v4

1 solution

Take a look at this : http://www.webdavsystem.com/home[^]
 
Share this answer
 
Comments
Yatin Bhagat 10-Nov-11 4:23am    
Dim url As String = Me.txtUrl.Text.Trim()
Dim port As String = Me.txtPort.Text.Trim()

'If the port was provided, then insert it into the url.
If port <> "" Then

'Insert the port into the Url
'https://www.example.com:80/fileToDownload.dat
Dim u As New Uri(url)

'Get the host (example: www.example.com)
Dim host As String = u.Host

'Replace the host with the host:port
url = url.Replace(host, host & ":" & port)

End If


'Create the request
Dim request As HttpWebRequest = _
DirectCast(System.Net.HttpWebRequest.Create(url), HttpWebRequest)

'Set the User Name and Password
request.Credentials = New NetworkCredential(Me.txtUserName.Text.Trim(), Me.txtPassword.Text.Trim())
request.Method = WebRequestMethods.Http.Get



Dim response As HttpWebResponse = Nothing

Try
'Get the response
response = DirectCast(request.GetResponse(), HttpWebResponse)

Catch ex As Exception

MessageBox.Show("An error occurred while attempting to retrieve data from the remote server. " & _
"The following error occurred while attempting to retrieve the data:" & vbCrLf & vbCrLf & _
ex.Message)

End Try


this is my code and it will show messeage 'Remote Server Not responding'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900