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

  • SEARCH
  • Home
  • 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 8462439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:10:02+00:00 2026-06-10T14:10:02+00:00

How to send data to authenticate to the server? Using the current code: WebClient

  • 0

How to send data to authenticate to the server? Using the current code:

WebClient MyWebClient = new WebClient();
        MyWebClient.OpenWriteCompleted += new OpenWriteCompletedEventHandler(MyWebClient_OpenWriteCompleted);
        MyWebClient.Headers["User-Agent"] = "Mozilla/4.0 (compatible; ICS)";
        MyWebClient.OpenWriteAsync(new Uri("http://myserver.com/login"), "POST", "email=myemail@server.com&pass=mypassword");


    void MyWebClient_OpenWriteCompleted(object sender, OpenWriteCompletedEventArgs e)
    {
        throw new NotImplementedException();
    }

After this code, if a program-sniffer (HttpAnalyzer) look at Headers and Response Content, in Response Content will be written: Request is not completed. waiting ..., and Response Headers will be empty …
How to make a Post request?

  • 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-10T14:10:03+00:00Added an answer on June 10, 2026 at 2:10 pm
    //Making a POST request using WebClient.
    
    
    Function()
    {    
      WebClient wc = new WebClient();
    
      var URI = new Uri("http://your_uri_goes_here");
    

    //If any encoding is needed.

      wc.Headers["Content-Type"] = "application/x-www-form-urlencoded";
    

    //Or any other encoding type.

    //If any key needed

      wc.Headers["KEY"] = "Your_Key_Goes_Here";
    
     wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);
    
     wc.UploadStringAsync(URI,"POST","Data_To_Be_sent");    
    

    }

    void wc__UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
    
    {  
    
      try            
      {          
         MessageBox.Show(e.Result); 
    

    //e.result fetches you the response against your POST request.

     }
    
      catch(Exception exc)         
      {             
         MessageBox.Show(exc.ToString());            
      }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using Ajax to send JSON data over to my server for a
I am send data from one service to other service using parecable, when I
Question: How do send data to a view model when using command binding? So
I send data between sockets in a C-application. I first bind the 'receiver' to
I send data in this way: <form method=post enctype=text/plain action=Func> And I have a
I am trying to send data as a model from an html form to
I am trying to send data through intent from one activity to another. But
I want to send data to a function after the default value of an
Is it possible to send data to another C++ program, without being able to
I am trying to send data to DotNetOpenAuth website as described here http://msdn.microsoft.com/en-us/library/debx8sh9.aspx Sender

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.