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 7791925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:03:03+00:00 2026-06-01T22:03:03+00:00

I have create an csv file in my windows phone, I want to post

  • 0

I have create an “csv file” in my windows phone,
I want to post it, in a server, in the web and I don’t find how I want to proceed for that,

I don’t want just make a “post request” with parameters, I want to post my File in the server…

Actually, I’m connect to this server, but it don’t find my file…

public void SentPostReport()
    {


        //Post response.
        string url = this.CurentReportkPI.configXml.gw; // string url 
        Uri uri = new Uri(url);

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
        request.Accept = "application/CSV";
        request.Method = "POST";
        request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), request);
    }

    private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

        // End the operation
        Stream postStream = request.EndGetRequestStream(asynchronousResult);

        // I create My csv File 
        CreateCsv reportCsv = new CreateCsv();
        string pathReportFile = reportCsv.CreateNewReport(this.report);
        string CsvContent = reportCsv.ReadFile(pathReportFile);

        // Convert the string into a byte array.
        byte[] byteArray = Encoding.UTF8.GetBytes(CsvContent);

        // Write to the request stream.
        postStream.Write(byteArray, 0, byteArray.Length);
        postStream.Close();

        // Start the asynchronous operation to get the response
        request.BeginGetResponse(new AsyncCallback(GetResponseCallback), request);
    }


    private static void GetResponseCallback(IAsyncResult asynchronousResult)
    {
        Debug.WriteLine("GetResponseCallback");
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

        // End the operation
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
        Stream streamResponse = response.GetResponseStream();
        StreamReader streamRead = new StreamReader(streamResponse);
        string responseString = streamRead.ReadLine();
        // Close the stream object
        streamResponse.Close();
        streamRead.Close();

        // Release the HttpWebResponse
        response.Close();
    }

Have you an idea when I proceed for resolve my problem,and send my CSV File with my request ?

Thanks.

  • 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-01T22:03:04+00:00Added an answer on June 1, 2026 at 10:03 pm

    Not sure if this is the problem here, but on a POST request, you are supposed to set the ContentLength and ContentType (“application/x-www-form-urlencoded”) headers, amongst other things…

    Please check this “how-to” article on a fully correct POST request — It’s not for Windows Phone, but I think you’ll still get the full ideia!

    On the other hand, I’d suggest you just go with RestSharp that will solve all these problems for you!

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

Sidebar

Related Questions

I've got a simple web-page that generates a CSV file that I want the
I have a .csv file containing 3 columns of data. I need to create
I have an exe that already creates a csv file. If I save the
I have a PHP app that creates a CSV file which is forced to
I have a Python script that reads through a text csv file and creates
I am trying to create a csv file of some data. I have wrote
I have a CSV file on my server. If a user clicks on a
I am trying to create a CSV file. I have done this. I have
I am trying to create a csv file using python that is truly Excel-compatible
I have create a CSV file in my php code, after create CSV, I

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.