none
在HttpClient Sample中,Scenario6_PostMultipart 传输的'data'值是在http协议格式中的哪个部分,我服务器不懂要去怎么获取所传的值 RRS feed

  • 问题

  • 在HttpClient Sample中,Scenario6_PostMultipart 传输的'data'值是在http协议格式中的哪个部分,我服务器不懂要去怎么获取所传的值

    HttpMultipartFormDataContent^ form = ref new HttpMultipartFormDataContent();
        form->Add(ref new HttpStringContent(RequestBodyField->Text), "data");

        // 'AddressField' is a disabled text box, so the value is considered trusted input. When enabling the
        // text box make sure to validate user input (e.g., by catching exceptions with TryGetUri as shown in scenario 1).
        Uri^ resourceAddress = ref new Uri(AddressField->Text);


        // Do an asynchronous POST.  We need to use use_current() with the continuations since the tasks are completed on
        // background threads and we need to run on the UI thread to update the UI.
        create_task(httpClient->PostAsync(resourceAddress, form), cancellationTokenSource.get_token()).then(

    ......


    传输部分的代码基本就这样,我要去哪找

        form->Add(ref new HttpStringContent(RequestBodyField->Text), "data");
    这个传上去的值?

    2014年7月18日 3:56

答案

全部回复

  • 你好 AntSworD,

    这个data就是要post的form,你的HTML页面需要有一个可以接受POST内容的方法才可以handle这个数据。

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月21日 8:06
    版主
  • 参考一下我今天回的一个帖子:http://social.msdn.microsoft.com/Forums/zh-CN/ec0ffd44-f7a6-4a53-8f8e-d15e13cfa5fb/windowswebhttphttpclientpost?forum=winstoreappzhcn

    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月25日 10:22
    版主