访问在服务器上使用WebClient.UploadData发送的确切数据 [英] Accessing the exact data sent using WebClient.UploadData on the server
问题描述
新手问题:我正在使用WebClient.UploadData方法将大型文本字符串以字节数组的形式发送到网站,但我不确定从服务器上检索该数据的确切位置.我读过一些帖子,说它已经在请求对象中了,但我该如何准确地检索我发送的特定字节数组,就像下面的c#伪代码一样:
Newbie question: I'm sending a large text string in the form of a byte array using the WebClient.UploadData method to a web site but I'm not sure exactly where to retrieve that data from on the server. I've read posts that say it is in the request object which I already know but how exactly do I retrieve the specific byte array I sent like in the following c# pseudo code:
byte[] dataSent = request.GettheByteArrayISentFromWebClientUploadDataMethod;
我知道这可能不那么简单,我可能需要做一些其他处理,但是任何人都可以张贴一个代码片段来显示如何获取发送的字节数组吗?
I understand that it may not be as simple as this and that I may need to do some other processing but can anyone post a code snippet that shows how I can get at the byte array that was sent?
Mucho谢谢
推荐答案
尝试从请求流如果要发送键/值对,则可以使用 UploadValues 方法,并简单地将其作为请求参数读取:
If you are sending key/value pairs then you could use the UploadValues method and read them simply as request paraneters:
string value = Request["someKey"];
这篇关于访问在服务器上使用WebClient.UploadData发送的确切数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!