Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9088701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:57:45+00:00 2026-06-16T21:57:45+00:00

I am working on porting an application from WPF to a Windows 8 App.

  • 0

I am working on porting an application from WPF to a Windows 8 App.

I would like to know if there is a similar functionality like System.Net.WebClient.UploadString in System.Net.Http.HttpClient namespace (since System.Net.WebClient isn’t available in WinRT) If yes an example is greatly appreciated! If not is there any alternative?

On the side note I was able to convert WebClient.DownloadString to its equivalent using System.Net.Http.HttpClient namespace with the help of Morten Nielsen post here http://www.sharpgis.net/post/2011/10/05/WinRT-vs-Silverlight-Part-7-Making-WebRequests.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:57:46+00:00Added an answer on June 16, 2026 at 9:57 pm

    Yes, you would use the PostAsync method.

    The method takes either a Uri or a string (just like the UploadString method on the WebClient class) as well as an HttpContent instance.

    The HttpContent instance is meant to be agnostic to different types of content, allowing you to specify not only the mechanism by which you provide the content (ByteArrayContent for an array of bytes, StreamContent for a Stream, etc.) but the structure as well (MultipartFormDataContent).

    That said, there is also a StringContent class which will send the string, like so:

    // The content.
    string post = “your content to post”;

    // The client.
    using (client = new HttpClient());
    {
        // Post.
        // Let's assume you're in an async method.
        HttpResponseMessage response = await client.Post(
            "http://yourdomain/post", new StringContent(post));
    
        // Do something with the response.
    }
    

    If you need to specify an Encoding, there’s a constructor that takes an Encoding, which you would use like this:

    // The client.
    using (client = new HttpClient());
    {
        // Post.
        // Let's assume you're in an async method.
        HttpResponseMessage response = await client.Post(
            "http://yourdomain/post", new StringContent(post),
             Encoding.ASCII);
    
        // Do something with the response.
    }
    

    From there, it’s a matter of processing the HttpResponseMessage (if that’s important to you, if it’s not a one-way operation) when the response is sent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on porting an app from WPF to Silverlight. The app uses custom
I am working on porting an existing VB.Net application to Java, and could not
I'm working on porting a windows-only application to Linux, and eventually to Mac OSX.
I'm porting some (working) code from Linux to Windows 8. I'm using DDK. typedef
I am working on porting a Windows Phone application to Windows 8 Metro, using
I am working on asp.net mvc3 application and have many records coming from database.
I am porting an ASP.NET application from 3.5SP1 to 4.0. The application works perfectly
So I am porting a legacy application over from coldfusion to asp.net/c#. My problem
We are currently working on porting an old VB6 application to WPF. The plan,
We're porting an application from Tru64 to SLES11 and the part that I'm working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.