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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:33:43+00:00 2026-06-10T23:33:43+00:00

I’m trying to implement a windows service application that downloads files from the FTP

  • 0

I’m trying to implement a windows service application that downloads files from the FTP server and save them into a network drive location specified in DB.
The network shared folder grants full access to “Everyone”

bool status = true;
string webError = string.Empty;
FtpWebResponse response = null;
Stream ftpStream = null;
FileStream outputStream = null;
FtpDownloadToFolder = @"\\servername\SharedFolder\";
fileName  = "test.jpg";

FtpWebRequest reqFTP = WebRequest.Create(new Uri(FtpAddress + "/" + fileName)) as FtpWebRequest;
reqFTP.Credentials = new NetworkCredential(FtpUser, FtpPassword);
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Timeout = FtpTimeout;
response = reqFTP.GetResponse() as FtpWebResponse;
ftpStream = response.GetResponseStream();

if (!FtpDownloadToFolder.EndsWith("\\"))
{
    FtpDownloadToFolder = FtpDownloadToFolder + "\\";
}
outputStream = new FileStream(FtpDownloadToFolder + "/" + fileName, FileMode.Create);

long cl = response.ContentLength;
int bufferSize = 2048;
byte[] buffer = new byte[bufferSize];
int readCount = ftpStream.Read(buffer, 0, bufferSize);

while (readCount > 0)
{
    outputStream.Write(buffer, 0, readCount);
    readCount = ftpStream.Read(buffer, 0, bufferSize);
}

so, here I’m trying to download a file from the FTP server into a network drive. But I get following error:

Access to the path '\\servername\SharedFolder\test.jpg' is denied.

System.Net.WebException: The remote server returned an error: 150 0.066 seconds (measured here), 3.78 Mbytes per second
---> System.IO.IOException: The operation is not allowed on non-connected sockets.
   at System.Net.Sockets.NetworkStream.InitNetworkStream(Socket socket, FileAccess Access)
   at System.Net.Sockets.NetworkStream..ctor(Socket socket, Boolean ownsSocket)
   at System.Net.FtpControlStream.QueueOrCreateFtpDataStream(Stream& stream)
   at System.Net.FtpControlStream.PipelineCallback(PipelineEntry entry, ResponseDescription response, Boolean timeout, Stream& stream)
   at System.Net.CommandStream.PostReadCommandProcessing(Stream& stream)
   at System.Net.CommandStream.PostSendCommandProcessing(Stream& stream)
   at System.Net.CommandStream.ContinueCommandPipeline()
   at System.Net.CommandStream.CheckContinuePipeline()
   --- End of inner exception stack trace ---
   at System.Net.FtpWebRequest.CheckError()
   at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
   at System.Net.CommandStream.Abort(Exception e)
   at System.Net.CommandStream.CheckContinuePipeline()
   at System.Net.FtpDataStream.System.Net.ICloseEx.CloseEx(CloseExState closeState)
   at System.Net.FtpDataStream.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at System.Net.FtpWebResponse.Close()

Am I missing something here? how do I copy a file from the FTP server into a network shared folder?

  • 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-10T23:33:44+00:00Added an answer on June 10, 2026 at 11:33 pm

    Typically your service is going to run under an account that is on the local host machine only. Thus it is not running from an authenticated account on your network. Just change the account the service is running under to make sure it is an account from your network AD and thus it will be part of the Everyone group you are referring to.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I'm trying to create an if statement in PHP that prevents a single post
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.