Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET
>
Tutorial
> Authentication
The following examples shows you how to use different authentication types.
C# example
using System; using System.Net; using Independentsoft.Webdav; namespace Sample { class Program { static void Main(string[] args) { //Basic or Digest authentication NetworkCredential credential = new NetworkCredential("username", "password"); //Windows Integrated Authentication //ICredential credential = CredentialCache.DefaultCredentials; WebdavSession session = new WebdavSession(credential); Resource resource = new Resource(session); string[] list = resource.List("http://myserver/dav/"); for (int i = 0; i < list.Length; i++) { Console.WriteLine(list[i]); } //Press ENTER to exit. Console.Read(); } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Webdav Module Module1 Sub Main(ByVal args() As String) 'Basic or Digest authentication Dim credential As NetworkCredential = New NetworkCredential("username", "password") 'Windows Integrated authentication 'Dim credential As NetworkCredential = CredentialCache.DefaultCredentials Dim session As WebdavSession = New WebdavSession(credential) Dim resource As Resource = New Resource(session) Dim list() As String = resource.List("http://myserver/dav/") Dim i As Integer For i = 0 To list.Length - 1 Console.WriteLine(list(i)) Next 'Press ENTER to exit. Console.Read() End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*