高性能webdav服务器,充分利用WebDAV服务器

400错误的请求我有以下PROFIND方法/请求WebDAV服务器:充分利用WebDAV服务器

strQuery = "<?xml version=\"1.0\"?>";

strQuery += "";

strQuery += "";

strQuery += "";

// Create a new CredentialCache object and fill it with the network

// credentials required to access the server.

MyCredentialCache = new System.Net.CredentialCache();

MyCredentialCache.Add(new System.Uri(strRootURI), "Basic", new System.Net.NetworkCredential(strUserName, strPassword));//, strDomain)

// Create the HttpWebRequest object.

Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(strRootURI);

Request.Proxy = GlobalProxySelection.GetEmptyWebProxy();

// Add the network credentials to the request.

Request.Credentials = MyCredentialCache;

// Specify the method.

Request.Method = "PROPFIND";

// Encode the body using UTF-8.

bytes = Encoding.UTF8.GetBytes((string)strQuery);

// Set the content header length. This must be

// done before writing data to the request stream.

Request.ContentLength = bytes.Length;

// Get a reference to the request stream.

RequestStream = Request.GetRequestStream();

// Write the SQL query to the request stream.

RequestStream.Write(bytes, 0, bytes.Length);

// Close the Stream object to release the connection

// for further use.

RequestStream.Close();

// Set the content type header.

Request.ContentType = "text/xml";

// Send the SEARCH method request and get the

// response from the server.

Response = (HttpWebResponse)Request.GetResponse();

// Get the XML response stream.

ResponseStream = Response.GetResponseStream();

// Create the XmlTextReader object from the XML

// response stream.

XmlReader = new XmlTextReader(ResponseStream);

// Read through the XML response, node by node.

while (XmlReader.Read())

{

// Look for the opening DAV:href node. The DAV: namespace is

//typically assigned the a: prefix in the XML response body.

if (XmlReader.Name == "a:href")

{

// Advance the reader to the text node.

XmlReader.Read();

// Display the value of the DAV:href text node.

Console.WriteLine("Value: " + XmlReader.Value);

Console.WriteLine("");

//Advance the reader to the closing DAV:href node.

XmlReader.Read();

}

}

// Clean up.

XmlReader.Close();

ResponseStream.Close();

Response.Close();

查询我从MSDN采取。我在strQuery部分或其他地方做错了什么?

我得到400 - Bad request。请帮忙 。

感谢,

Subhen

2010-06-28

Simsons

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值