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 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 an XML file, using HTTP protocol, to use it locally
I need to download a Cab file from a Url into a stream. using
Need to login and download xml file from the below url : http://www.radionyhetene.net/download/nyheter/mp3/nyheter.xml I
I need to download file from FTP server and make some changes on it
I need to download one file from an url that i give from an
i need to save a xml file from a server.. i found a code
I need a master computer to be able to download a predefined XML file
I need to download and unzip a sitemap.xml file that is compressed (maybe tar
We need to download the latest version of some xml feed from a 3rd
In my application I download some xml data file from some information center, add

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.