Error in Automatic Upgrade Component: Unable to instantiate HTTP request stream

Source: Internet
Author: User

When downloading the new version, you need to list the directory files, obtain all the files under the directory on the server, and then download them.
However, an error is reported when an XML request is sent.
Httpwebrequest request = (httpwebrequest) httpwebrequest. Create (URL );
Request. headers. Add ("translate: F ");
Request. Credentials = credentialcache. defaultcredentials;

String requeststring = "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+
"<A: propfind xmlns: A = \" Dav: \ ">" +
"<A: prop>" +
"<A: displayname/>" +
"<A: iscollection/>" +
"<A: getlastmodified/>" +
"</A: prop>" +
"</A: propfind> ";

Request. method = "PROPFIND ";
If (deep = true)
Request. headers. Add ("depth: infinity ");
Else
Request. headers. Add ("depth: 1 ");

Request. contenttype = "text/XML ";
Request. contentlength = requeststring. length;
Stream requeststream = NULL;
Try
{
Requeststream = request. getrequeststream ();
// Failed to create the stream. 501 error. The server does not support this function!
// But I have set this directory as a "Browse Directory". Dav? is not supported ?? No.
}
Catch (exception ER)
{
Debug. writeline ("Z. J. Chen: can't create a HTTP request stream! "+ Er. Message );
Requeststream. Close ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.