WebClient uploads files

Source: Internet
Author: User
WebClient Client  =     New  WebClient ();
String Txt = Client. downloadstring ( " Http: // localhost/test.html " );
Txt = Txt + " La la Ali " ;
Byte [] Byts = System. Text. encoding. Default. getbytes (txt );
Stream stream = Client. openwrite ( " Http: // localhost/test11.html " , " Put " );
Stream. Write (byts, 0 , Byts. Length );
Stream. Close ();
Stream. Dispose ();

If you encounter a 405 problem, consider the following points:

1. Enable the WebClient Service in the service

2. The fileupload folder in IIS is set on the attributes of IIS and physical folders to allow anonymous accounts to be modified.

3. the upload path must be http: // localhost: 8011/fileupload/xx.jpg, not just http: // localhost: 8011/fileupload/

4. IIS attributes. Allow put actions,

Note that the four points are completely uploaded.

From: http://social.msdn.microsoft.com/Forums/zh-CN/295/thread/54eadf9d-71a2-4196-9eb1-969612ca81f3

Related Article

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.