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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:57:13+00:00 2026-05-31T19:57:13+00:00

I need to perform a cURL request to grab a CSV file from the

  • 0

I need to perform a cURL request to grab a CSV file from the web. I’ve never used cURL before and so far the stuff I have seen via google doesn’t seem to make sense:

the cURL call needs to look like this:

curl --user username:password http://somewebsite.com/events.csv

the code I am trying to use ( i use this to grab basic auth XML files)

string URL = "http://somewebsite.com/events.csv";
string Username = "username";
string Password = "password";
WebClient req = new WebClient();

CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(URL), "Basic", new NetworkCredential(Username, Password));

req.Credentials = myCache;

string results = null;
results = Encoding.UTF8.GetString(req.DownloadData(URL));

This just gives me back the html for a login screen so the authentication is not happening.

  • 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-05-31T19:57:14+00:00Added an answer on May 31, 2026 at 7:57 pm

    I found the issue. Apparently the request fails when you pass an @ sign ( like in the email username ) in the username field so it must be Converted to a base 64 string. Here is the code just in case someone else runs into this:

        string url = "https://website.com/events.csv"; 
        WebRequest myReq = WebRequest.Create(url);      
        string username = "username";
        string password = "password";
        string usernamePassword = username + ":" + password;
        CredentialCache mycache = new CredentialCache();
        mycache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
        myReq.Credentials = mycache;
        myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
    
        WebResponse wr = myReq.GetResponse();
        Stream receiveStream = wr.GetResponseStream();
        StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
        string content = reader.ReadToEnd();
        Console.WriteLine(content);
        Console.ReadLine();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to perform send photo functionality. I have a web service method which
I need to perform http PUT operations from python Which libraries have been proven
I use curl for grabbing data from sites, but now I need to grab
I need to perform a filtered query from within a django template, to get
I need to perform a HTTP GET from PHP. More specifically, from within /index.php
I need to perform a LINQ query for both a time period from a
I need to perform an action after a session times out. However I have
I need to perform facebook post into the user wall from wp7 (but without
I need to perform asp.net web-service function call via jQuery and pass asp.net application
I need to perform queries in a ADO.NET model by using LINQ. I have

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.