Tuesday, October 23, 2007

Getting Status Code of a Web Request "MKCOL"

try
{

System.Net.HttpWebRequest Request = System.Net.HttpWebRequest)HttpWebRequest.Create(folderURI);
Request.Method = "MKCOL";
System.Net.HttpWebResponse Response = (System.Net.HttpWebResponse)Request.GetResponse();
}
catch (WebException ex)
{
HttpWebResponse response = (HttpWebResponse)ex.Response;
if (response.statusCode == 405)
{
Console.WriteLine("The MKCOL method can only be performed on a deleted or non-existent resource.");
}
}

1 comment:

Anonymous said...

Greetings from Colorado! I'm bored to tears
at work so I decided to check out your website on my iphone during
lunch break. I love the information you present here and can't wait to take a look when I
get home. I'm amazed at how quick your blog loaded on my mobile .. I'm
not even using WIFI, just 3G .. Anyways, fantastic blog!


my blog post :: view my web page
Also see my webpage :: Click here