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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:58:47+00:00 2026-05-20T10:58:47+00:00

I need to download xml file from a secure link, and store the content

  • 0

I need to download xml file from a secure link, and store the content into database.

Can i use text reader??? or i need to store the file into my local file system first, then read the content from my file system and store into my database?

HttpWebRequest downloadRequest = (HttpWebRequest)WebRequest.Create("https://line-to-xml-file.xml");
string Content;

                downloadRequest.Credentials = new NetworkCredential()
                                              {
                                                  UserName = this._userCredentials.UserName,
                                                  Password = this._userCredentials.Password
                                              };

                downloadRequest.PreAuthenticate = true;

                using (HttpWebResponse downloadHTTPResponse = (HttpWebResponse)downloadRequest.GetResponse())
                {
                    using (Stream downloadResponseStream = downloadHTTPResponse.GetResponseStream())
                    using (TextReader tReader = new StreamReader(downloadResponseStream))
                    {
                        Content = tReader.ReadToEnd();
                    }
                }
              return Content;

Since the remote file is huge, up to 100MB, i can see nothing from debug.
and when i try to save it.

using (TransactionScope trans = new TransactionScope()) <--- when comes to this line, exception throws...
{
// perform update, save the content into databse
// send a notification message to message bus, indicate content has been updated
}

It complain MSDTC transaction timeout/cancelled

  • 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-20T10:58:48+00:00Added an answer on May 20, 2026 at 10:58 am

    By having it into a stream you should be fine… if you have any problem with that specific stream then you could use a MemoryStream instead of a FileStream and use it the same way. But I hardly doubt this is your case.

    I think you should make also sure to open the connection RIGHT BEFORE you are going to save the stream and when you have it completely loaded… You can also play with your Command.TimeOut property if it is taking really, really long to save, here “A value of 0 indicates no limit” but this should be avoided.
    but

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

Sidebar

Related Questions

I need to download and unzip a sitemap.xml file that is compressed (maybe tar
In C#, if I need to open an HTTP connection, download XML and get
I need to periodically download, extract and save the contents of http://data.dot.state.mn.us/dds/det_sample.xml.gz to disk.
I need help with downloading from webserver... What i currently do is get XML
I'm needing to load an XML document into PHP that comes from an external
I am using the following methods to download an xml file private void LoadXMLFile()
i download many html store in os,now get their content ,and extract data what
I need customers to be able to download PDFs of letters that have been
I have a need to allow for a user to download an event that
Quick (and hopefully easy) question: I need to trigger a download of a PDF

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.