本文介绍了使用新的System.Net.WebClient发布字段和文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们的目标是模拟一个传统的表单文章,并将其与一个新的System.Net.WebClient调用一个webapi,并且没有发现任何特殊的例子。一些字段和一个文件。
我怎样才能使用System.Net.WebClient或者我在哪里可以找到一些例子?
提前致谢
解决方案
我想你需要这个:
这是一个写得很好的博客。看最后一个例子。
i'm trying to invoke a webapi with the new System.Net.WebClient and didnot found any special examples.
The goal is simulate a traditional form post with some fields and a file.
how can i do it using the System.Net.WebClient or where can i find some examples?
thanks in advance
解决方案
I think you need this:
http://dzimchuk.net/post/uploading-a-file-over-http-in-net
This is a very well written blog. See the last example.
这篇关于使用新的System.Net.WebClient发布字段和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!