I have a vb.net Tool, that Downloads a *. Zip file from a SharePoint Server. Till now it worked under SharePoint 2007.
Under SharePoint 2013 and I’m not abel to Download the File anymore. Under SharePoint 2013 the User has to Authenticate himself over this mask Authentication side in the Browser.
This was the Old Solution that worked on SharePoint 2007
Dim WebIntranet As New WebClient
Dim strURL as String = "https://example.com/content/P123456/Documents/File.zip"
WebIntranet.UseDefaultCredentials = True
'Download the File from the Server
WebIntranet.DownloadFile(strURL,
"D:\Temp\File.zip ")
For the new Solution it didn’t work and i tryed a few things:
First Approch:
Dim client As New WebClient
Dim _UserAgend As String = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
Dim strURL as String = "https://example.com/content/P123456/Documents/File.zip"
client.Headers.Add(HttpRequestHeader.UserAgent, _UserAgend)
WebIntranet.DownloadFile(strURL,
"D:\Temp\File.zip ")
Second Approch:
Dim securedPassword As SecureString = New SecureString
Dim _UserAgend As String = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
Dim username As String = "[email protected]"
Dim password As String = "123456"
client.Headers.Add(HttpRequestHeader.UserAgent, _UserAgend)
For Each c In password.ToCharArray()
securedPassword.AppendChar(c)
Next
client.Headers.Add(HttpRequestHeader.UserAgent, _UserAgend)
client.Credentials = New NetworkCredential(username, securedPassword) WebIntranet.DownloadFile(strURL,
"D:\Temp\File.zip ")
Both of the Approches didn’t work, they did not Donwloaded the File from the Sharepoint.
They only Downloaded the Authenticaton side and named it "File.zip"
Any help is welcomed
Raw Request from the Download


I don't know, if it works for your authentication method, but I could download a file like this (set reference to Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime):
BASE_URL,LIST_TITLEandITEM_IDI got from the URL when browsing the file-to-download in the browser.I hope this helps.