The remote server returned an error: (550) File unavailable (e.g., file not found, no access).

Hello everyone,

 I have the FTP Upload module that do the upload files from the client side to the FTP, but it complains at this code  Dim requestStream As Stream = request.GetRequestStream() , and gives me an error message "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)." The file is available and at the  c"\test\ast.pdf, Can someone help me out with this, thanks

Imports System

Imports System.IO

Imports System.Net

Imports System.Text

Public Class FTPUploadFile
Public Shared Sub Sub_Upload(ByVal args() As String)

 

Dim hostname As String = args(0)     'ftp://abc.com or IP address

Dim fileName As String = args(1)      'c"\test\ast.pdf

Dim username As String = args(2)     'anonymous

Dim password As String = args(3)      '124@

' Get the object used to communicate with the server.

Dim request As FtpWebRequest = DirectCast(WebRequest.Create(hostname + "/" + fileName), FtpWebRequest)

request.Method = WebRequestMethods.Ftp.UploadFile

' Assumes the FTP site uses anonymous logon.

request.Credentials = New NetworkCredential("anonymous", "124@")

' Copy the contents of the file to the request stream.

Dim sourceStream As New StreamReader(fileName)Dim fileContents As Byte() = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())

sourceStream.Close()

request.ContentLength = fileContents.Length

Dim requestStream As Stream = request.GetRequestStream()      'Complain at this code right here

requestStream.Write(fileContents, 0, fileContents.Length)

requestStream.Close()

Dim response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription)

response.Close()

End Sub

End Class

0
Orchid22
12/7/2007 3:16:19 PM
asp.net.getting-started 91979 articles. 2 followers. Follow

6 Replies
5700 Views

Similar Articles

[PageSpeed] 23

Did you ever figure out a fix to this?  I'm having the exact same problem you had.


Thanks!

Dave Durose
0
ddurose
4/4/2008 6:20:42 PM

Hey Hi,

please try using requestStream.Flush();   before closing the requestStream..........just a thought

Thanks


Keyboard not found. Please Press < F1 > to RESUME

Please Remember to Mark as Answer for the post(s) that help you.....so it can help others......Thanks
0
novicehere
4/4/2008 8:01:42 PM

hi!

does your ftp server allow anonymous userS? The error message could be connecteD to this issue.

are youwilling to do not use anonymous userS and use full usernameS?

ciao ;_)


jan maru

Click "Mark as Answer" on the post if my words were helpful.

0
janmaru
4/4/2008 8:09:06 PM

hi!

I'll add some code if your server doesn't allow anonymous connectionS and you want to use not anonymouS, not better then your code but a possible challenge....

 

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Net
imports System.IO
imports System.Collections
 
 Public Sub UploadFile(ByVal Path As String, ByVal LocalPath As String, ByVal Name As String)
        Try


            Dim _fileName As String = LocalPath + "\" + Name
            Dim _File As FileInfo = New FileInfo(_fileName)

            _FtpRequest = CType(WebRequest.Create("ftp://" + _Host + Path + Name), FtpWebRequest)

            _FtpRequest.Credentials = New NetworkCredential(_UserName, _Password)
            _FtpRequest.Method = WebRequestMethods.Ftp.UploadFile
            _FtpRequest.EnableSsl = _UseSSL

            Dim _fileContents(_File.Length) As Byte

            Dim fr As FileStream = _File.OpenRead()

            fr.Read(_fileContents, 0, Convert.ToInt32(_File.Length))

            fr.Close()

            Dim writer As Stream = _FtpRequest.GetRequestStream()

            writer.Write(_fileContents, 0, _fileContents.Length)
            writer.Close()
        Catch ex As Exception

        End Try

 end sub

#Region "variabili"

    ''' <summary>
    ''' Host FTP
    ''' </summary>
    Private _Host As String
    ''' <summary>
    ''' Username
    ''' </summary>
    Private _UserName As String
    ''' <summary>
    ''' Password
    ''' </summary>
    Private _Password As String

    ''' <summary>
    ''' Richiesta FTP
    ''' </summary>
    Private _FtpRequest As FtpWebRequest
    ''' <summary>
    ''' Risposta ftp
    ''' </summary>
    Private _FtpResponse As FtpWebResponse

    ''' <summary>
    ''' Flag SSL
    ''' </summary>
    Private _UseSSL As Boolean = False

#End Region

#Region "Proprietà"

    ''' <summary>
    ''' FTP Host URI
    ''' </summary>
    Public Property Host() As String
        Get
            Return _Host
        End Get
        Set(ByVal value As String)
            _Host = value
        End Set
    End Property

    ''' <summary>
    ''' FTP User Name
    ''' </summary>
    Public Property UserName() As String
        Get
            Return _UserName
        End Get
        Set(ByVal value As String)
            _UserName = value
        End Set
    End Property

    ''' <summary>
    ''' FTP Password
    ''' </summary>
    Public Property Password() As String
        Get
            Return _Password
        End Get
        Set(ByVal value As String)
            _Password = value
        End Set
    End Property

    ''' <summary>
    ''' Flag utilizzo SSL
    ''' </summary>
    Public Property UseSSL() As Boolean
        Get
            Return _UseSSL
        End Get
        Set(ByVal value As Boolean)
            _UseSSL = value
        End Set
    End Property

#End Region

 

ciao ;-)


jan maru

Click "Mark as Answer" on the post if my words were helpful.

1
janmaru
4/4/2008 8:19:11 PM

I didn't solve with this way.

alp


www.maskorganizasyon.com.tr
0
alpaslan11
4/4/2008 8:23:34 PM

 dear friend

  this error is not related to ur code,mainly because you may not set the required write permission related to ftp.consult network related people to solve this .very easy

0
rejeeshnv
2/10/2009 8:54:01 AM
Reply:

Similar Artilces:

The remote server returned an error: (550) File unavailable (e.g., file not found, no access). #3
Well, I have a file on my local machine root called ftp.txt which consists of the the word test.  Line 26 is highlighed each time I run this in green. Does anyone know how to fix this? I run this and I get the response in the subject of this thread.  It's connecting properly. I've deleted my login info in line 5. I'm not sure what this message is referring to. It says remote server, so can I assume that it logged into my site? Why isn't it sending the file on my local hard drive to the directory of this ftp login?1 Protected Sub cmdUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpload.Click 2 'On button Click call the function 3 'and Pass Parameter Values 4 'Display Message on Success 5 uploadFileUsingFTP("ftp://www.mortgage-pros.com/links/ftp.txt", "C:\ftp.txt", "", "") 6 lblMsg.Text = "File Uploaded Successfully :)" 7 End Sub 8 9 Public Sub uploadFileUsingFTP(ByVal CompleteFTPPath As String, ByVal CompleteLocalPath As String, Optional ByVal UName As String = "", Optional ByVal PWD As String = "") 10 'Create a FTP Request Object and Specfiy a Complete Path 11 Dim reqObj As FtpWebRequest = WebRequest.Create(CompleteFTPPath) 12 'Call A FileUpload Method of FTP Request Object 13 reqObj.Method = WebRequestMethods.Ftp.UploadFile 14 'If you wa...

The remote server returned an error: (550) File unavailable (e.g., file not found, no access). #2
Another "(550) File unavailable" error, this time when READING a file. Receiving error: "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)." (with Status = ProtocolError {7}) when using the FtpWebRequest and FtpWebResponse objects to read the contents of a text file.  I am certain the file exists and I have access to read the file. Has anyone seen this?  Can you help?  Thanks :-) Imports SystemImports System.TextImports System.IOImports System.NetPublic Module ftpRead     Public Sub ftpRead()&...

The remote server returned an error: (550) File unavailable (e.g., file not found, no access).FTP uploading
hi, i am uplaoding files using FTP. first time file is moving to ftp server next time onwards i am getting error like  "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)." my code is Public Sub uploadFileUsingFTP(ByVal CompleteFTPPath As String, ByVal CompleteLocalPath As String, Optional ByVal UName As String = "xxx", Optional ByVal PWD As String = "xxx")Dim reqObj As FtpWebRequest = WebRequest.Create(CompleteFTPPath) reqObj.Method = WebRequestMethods.Ftp.UploadFile reqObj.Credentials = New NetworkCredenti...

File unavailable (e.g., file not found, no access).
I'm having a hard time with this thing.  Which file is it referring to?  The file it's going to upload to the remote server?  Or, is the the path to where it's supposed to write the file on the remote server?   The files that are supposed to be transferred to a remote server are at the moment sitting on the root of my site.  Here's the error: [WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access).] System.Net.FtpWebRequest.SyncRequestCallback(Object obj) +321 System.Net.FtpWebRequest.Reque...

Help! The remote server returned an error: (550) File unavailable
Hi all,  This code is supposed to FTP a file from my server to a remote website when I click the upload button.  I get an error message.    [WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access).]   System.Net.FtpWebRequest.SyncRequestCallback(Object obj) +321   System.Net.FtpWebRequest.RequestCallback(Object obj) +19   System.Net.CommandStream.Abort(Exception e) +163   System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage) +453   System.Net.FtpWebRequ...

Access files from remote file server?
Hello All - We currently have a VB6 app that we are converting to .NET, and we've come across an interesting dilemna. Right now, the VB6 app is for internal employees only, and there is a button on a form that pops open a directory on a shared drive in an open file dialog. Is there someway in .NET that will allow us to list the contents of a directory from a remote server? This app will no longer be internal only, and will be used by users from the internet. Are there any security implications with performing this type of action?  Any help is greatly appreciated! if the applictai...

Cannot read stylesheet file in the App_Themes folder! Error: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).
Help!  I am trying to use themes in my MVC application.  If I add a stylesheet in my theme folder, I just get this error:  Using themed css files requires a header control on the page. (e.g. <head runat="server" />). This particular error cannot be true in my case because I do have a runat="server" inside my header tags.  Now I know adding a stylesheet in my theme folder definitely gives me this error because if I excluded it, it still gives me this error, and if I delete the stylesheet, my application will render fine.  Could this ...

Trying to get File.open to open file on remote server
The title is kind of lame. What I'm doing is that I had been developing on the production server (don't ask), and now I've moved development to my workstation. I have a bit of code in an aspx the opens a pre-formatted html and puts it into a label. The code is as follows. Dim FILENAME As String = "D:\Inetpub\wwwroot\articles\news.htm" Dim objStreamReader As StreamReader objStreamReader = File.OpenText(FILENAME) articles.Text = objStreamReader.ReadToEnd() objStreamReader.Close() This worked fine and the aspx on the product...

Direct file access for remote files (XE4
Hello! Is it possible/allowed to have direct access to file on remote files on same network? For example: {code} AssignFile(f, '\\server\share\file.txt'); Reset(f); ReadLn(f, rowdata); CloseFile(f); {code} Or do I need to communicate via service? Greetings, Werner ...

System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
I have written a web service and tested it and it works fine from the .asmx test page. However, when I attempt to call it with a post I get this error:  The remote server returned an error: (500) Internal Server Error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.Source Error: Line 164: myStream.Close() Line 165: Line 166: Dim SomeResponse As WebResponse = XmlHttp.GetResponse() Line 167: Dim strm As Stream = SomeResponse.GetResponseStream() Line 168: Dim sr As StreamReader = New StreamReader(strm) Source File: c:\inetpub\wwwroot\SCNet\App_Code\SCClientSvc.vb    Line: 166 Why does the test work fine but give a 500 error when I just try and get the response? Hi This is a general error message.  Pls take a look at the event log on server to view detailed error message. Make sure the Url you specified in code is correct.NOTE:If you find my response contains a reference to a third party World Wide Web site, I am providing this information as a convenience to you.Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,Microsoft cannot make any representations regarding the ...

Cannot Access Files on Vol1 keep getting op-lock errors on the server
Cannot Access Files on Vol1 keep getting op-lock errors on the server. Users systems keep locking up after trying to access these files. Note clients are XP Pro, Client is 4.90 sp2 W/post sp2 patches, Server is Netware 6.0 small business W/ no Service patches. temp1965@comcast.net, First thing you should do is to apply the latest Support Pack on the server. Also add the following parameters to the beginning of the server autoexec.ncf file; set Client File Caching Enabled=Off set Level 2 Oplocks Enabled=Off Restart the server to get the changes to take effect. -- //...

Unable to get the project file from the web server
Hello, I had the Commerce kit installed on my machine and working for a while. After uninstalling it using Add and Remove program, I installed it again and now the solution would not open in Visual Studio .net. I get an error saying "Unable to get the project file from the web server" Anyone know what is happening and how I can fix this? Other project that I have on my machine are opening fine. Anyone else have this problem? I cant get it to work, today I re-installed VS.net but am having the same problem. I even tried installing into a different folder but no ...

Access Denied while window service in .net trying to create a file on remote server
Hi,              I am facing serious problem while running window service.              My window service is running on remote machine(in the same private network) and I am trying to create a file using window service on my machine. When I am trying to create the file, the path I am giving is \\MyMachine\MyFolder. But, is giving 'Access Denied' exception. I need this asap. Hope I will get the response soon.   Thanks in advance, Kalyan.    &nb...

Error in different perl scipt file
Dear Friends, I am beginner & i am new in perl scripting language, currently i using perl 5.8.8 version. I installed DBI module through CPAN to connect different database. Yes i got output by connecting to the database. My problem is : My first perl script filename is : first.pl My second perl script filename is : second.pl * When i run my first perl script file ( first.pl ) it running and i got the output. * But when i used to run my second perl script file ( second.pl ) its not running & i didn't get the output. Its showing "In...

The remote server returned an error: (503) Server Unavailable
Hi I'm not sure if this is the right place to post this...The thing is that I'm trying to fetch a Xml file from a url coz I don't want to save it everytime a post is made. string uri = @"http://www.whatever.com/myxmlfile"; //this returns an xml file!XmlReaderSettings xs = new XmlReaderSettings();XmlReader x = XmlReader.Create(uri, xs); But when I do this, it gives me the following error: The remote server returned an error: (503) Server Unavailable. I would appreciate any help. ThxAndré da Silva Carrilhohttp://andrecarrilho.blogspot.com/http://dotnetslackers.com/community/blogs/andrecar...

The remote server returned an error: (503) Server Unavailable.
Hello All. Here is my scenario - I have a website and webservice on my box. IIS 6.0 (win2k3 or WinXP 64). The webservice does some operation and website is UI. The work flow is UI calls Webservice and once operation is completed, Webservice calls UI. When the webservice calls the UI, I get the above error. When the link is called from a browser, the website is accessible. Most HTTP headers are in place - User-Agent = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB5; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; MSN Optimized;US)Referer = http://ABCXYZ/Default.asp...

Error : "E. No offline transaction log file found, Online transaction log starts at offset XXXXXXXX"
I am getting a mobilink sync problem. Please give me your valuable suggestions everything is fine after reading the subscription, the ml client gives the following error. None reported in the server window I. Begin synchronizing for "xx" for user id "xx" E. No offline transaction log file found, online transaction log starts at offset at "xxxxxx" E. upload aborted at "xxxxxx" E. download aborted Thanks for your help DIL "DIL" <skumar@ameren.com> wrote in news:OQ4zcmZvCHA.155@forums.sybase.com: >...

Apache access files on seperate file server
I have searched for an answer to this, but they all relate to *nix. I want to take Apache off of our file server cluster and put it on it's own server. The file server is NetWare OES. My question is, how do I tell Apache to serve the files off of the file server? I have this currently working on a NetWare 6 server with Apache 1.3.31. Part of my conf file is below: .... # Start Apache Services Port Configuration Port 80 Listen 10.1.2.22:80 <IfModule mod_tls.c> SecureListen 10.1.2.22:443 "SSL CertificateDNS" </IfModule> # End Apache Services P...

downloading files, get errors, as file could not be saved.
Name: Egon Mainey Email: p33ka8oo_at_hotmail.com Product: Deer Park Summary: downloading files, get errors, as file could not be saved. Comments: I've tried to download a few files from nvidia and asus.tw, both times I get the following C:/docume~1\admin~1\locals~1\temp\oivoh98f.exe could not be saved, because the source file could not be read. I don't know weather it is a problem with XP64 or deerpark. I've had to resort to IE to get the files, which worked fine. If I've mad a mistake let me know or point me in the direction of the work around, you got my email. I know it's a beta and I don't mind finding bugs/problems. Thank god I can browse with Tabs and only have to resort to IE for the downloads. Keep up the good work guys, long live firefox/deerpark :) Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; en-US; rv:1.8b2) Gecko/20050628 Firefox/1.0+ ...

Error while opening an excel file : file could not be found
Hi All,   I am using the below code to export data from datagrid to excel.     dtgDailyReports.AllowSorting = false;                         DataSet ds = new DataSet();                         ds = (DataSet)ViewState["DailyReport"];                  ...

Slow server file access but not file transfer
I had this problem start at 4pm yesterday on our main file server. No patches or config changes have been made. NW 6.5 sp4a. File access is abysmal. If you open anything, a folder, file what have you, from the moment you click it and attempt to do anything else, right click, hit control c, hit delete, it's about a 12-15 second delay, and then it goes right away. If I drag a 1GB file to the server, it will sit for approximately 15 seconds and do nothing, and then the file will start to transfer and is done in about 20 seconds. It's not a bandwidth issue, once the t...

Error E1026 File Not Found (dfm files)
I am using Delphi 2009. When I try to compile or build my project, I am getting multiple instances of the following error [DCC Error] E1026 File not found: [myunit].DFM These are units which are not in my project, but are in other projects that I have successfully built and run. All the dcu files are in one directory, and this directory is on the library path for my current project. I can overcome the problem by putting all the source file directories on the library path, but I do not understand why I have the problem. As it happens, I have the source files. But if I only had the d...

Getting development files from compiled server files
I just took on a new project and they sent me a zip file of the compiled published files from the web server. They don't seem to want to contact the original developer for his local copy and I am wondering if there is a way to get the development files from the compiled files? There are no codebehind files and I'm getting multiple errors when I try to compile saying that files are missing. Hi Fashionista007,  You can use Reflector to Decompile the Assemblies as long as the original developer didn't obfuscate their code.  from there you will be able to rebu...

Web resources about - The remote server returned an error: (550) File unavailable (e.g., file not found, no access). - asp.net.getting-started

Clinton Apologizes For Praising Nancy Reagan For 'Starting HIV/AIDS Dialogue'
I realize there aren't a lot of things good to say about Nancy Reagan, but maybe Hillary Clinton should have considered just a general statement ...

GM buys Cruise Automation in a bid for autonomous driving
As it plunged toward bankruptcy in 2009, General Motors Co. was slammed for its reluctance to change. Now, with the auto industry speeding toward ...

North Korea Is Frantically Searching For One Of Its Submarines: Report
Details remain scarce, but reports state that North Korea has lost one of its submarines. It is not clear what exactly the suspected state of ...

Video: A Quick Look at What’s New in Edge Panel on the Galaxy S7 Edge
During my review of the Galaxy S6 Edge, I turned off the Edge Panel features. Why? Franky, because they sucked. On the Home screen, there was ...

The mysterious and mounting deaths of former Putin allies turned critics
News that former Kremlin aide Mikhail Lesin, who was found dead in Washington in November, died from "blunt force injuries to the head" has thrust ...

This Week's Most Popular Posts: March 4th to 11th
This week Google surprised us with a developer preview of Android N , the next version of their phone OS. What’s the N stand for? Given their ...

Adobe Flash Player update fixes critical vulnerabilities
In a story similar to many from the company's history, Adobe has pushed out a new emergency update that patches many critical Flash Player bugs. ...

Missing Binghamton Teen Sisters Found 11 Months Later
Daily Beast Missing Binghamton Teen Sisters Found 11 Months Later Daily Beast Police reported them as runaways, but now believe they were ...

Amazon’s Echo listens to the radio, commits hostile takeover of a user’s home
Just days ago, Amazon expanded its lineup of Alexa-equipped devices with the debut of the Tap and the Echo Dot . The virtual assistant has been ...

Honda Clarity goes on sale in Japan, but only 200 units a year
Filed under: Green , Honda , Car Buying , Japan , Sedan , Hydrogen The Honda Clarity is now available in Japan, but the company limits its to ...

Resources last updated: 3/11/2016 4:13:11 PM