-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
42 lines (36 loc) · 1.25 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Net;
using WebDAVSharp.Client.WebDav;
namespace WebDAVSharp.Client
{
/// <summary>
/// This program will do a PROPFIND request to the WebDAV server.
/// The statuscode and statusdescription will be written to the console.
/// </summary>
class Program
{
// change according to your configuration
private const string Url = "http://localhost:8880/";
/// <summary>
/// Mains the specified arguments.
/// </summary>
/// <param name="args">The arguments.</param>
static void Main(string[] args)
{
Console.WriteLine("PROPFIND " + Url);
// do the request and get the WebResponse
WebResponse response = WebDavMethod.Propfind(Url);
// cast to an HttpWebResponse
HttpWebResponse httpWebResponse = response as HttpWebResponse;
// if not null, write statuscodes to the console
if (httpWebResponse != null)
{
Console.WriteLine((int)httpWebResponse.StatusCode + " " + httpWebResponse.StatusDescription);
}
else
{
Console.WriteLine("HttpWebResponse was null.");
}
}
}
}