.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

Cannot move file from one ftp directory to another in .NET Framework 4.0

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :.NET Framework
 

I'm in the progress of updating my C++ code from visual studio 2005 to visual studio 2010.  I've come across a problem where the FtpWebRequest class is unable to move a file from one directory to another directory on a ftp server when an absolute FtpWebRequest::RenameTo path is specified.

For example, I want to move the file, file.txt from source to destination as follows:
source: /working/
destination: /data/

An example of the code I use to handle this is below:

    Uri^ target = gcnew Uri( gcnew String("FTP://servername//working/file.txt"));
   
    FtpWebRequest^ request = dynamic_cast<FtpWebRequest^>(WebRequest::Create( target ));
   
    request->Credentials = gcnew NetworkCredential( gcnew String("username"), gcnew String("password") );


    request->EnableSsl = (ftpType == ftpTypeFTPS) ? true : false;
    request->KeepAlive = false;
    request->Method = WebRequestMethods::Ftp::Rename;
    request->RenameTo = gcnew String("/data/file.txt");
    request->GetResponse()->Close();


The problem is that FtpWebRequest treats the FtpWeb


View Complete Post


More Related Resource Links

Directory.Move leads to corrupted 'file'

  

Hello All,

 

I have earlier used Directory.Move to move one folder into an existing sub folder. The path I specified happened to have a slightly different case to the existing directory (temp vs Temp), and the result is two folders, one called temp the other Temp. Normally we can't do this through windows as it recognises the two folders to ultimately have the same name regardless of case. I expected the .NET class to handle in the same way.


I've deleted the original Temp folder, but this 'temp' directory still remains... it's recognised by Windows as a directory yet also reported as not existing! Whilst I could probably live with a redundant corrupt file somewhere on my disk it's really causing some problems with recursive functions that, like the rest of windows, get confused by the directory which exists but doesn't exist.

Has anybody had this same problem? Or rather, how can I fix this?

 

Running VS2008 on Win7.

 

Regards,

Chris


How to connect two machines for directory/file operation like copy/move etc in C#

  

Hi All-

I wants to write c# code for a file transfer tool. My basic requirment is that, copying directories/files or moving directories/files from one machine to another machine.

For that I am populating source machine drives, directories and files into a first tree view control.

Now I wants to connect to onther machine which will be a destination machine and populate the drives, directories and files into second treeview control to copy/move the directories from source machine.

To connect, I will provide IPAddress, Port number, user name and password of destination machine.

To accomplish this,

which type of connections could be used?

How many connections type are there?

If the two machines are same LAN/Network how to connect together?

What is client/server connection mode?

What type of transfer protocal could be used?

Please give all the details about this.

Thanks in advance


Get .doc or .docx file from Directory

  

Hi,

I want to get files(.doc,.docx) from Directory and show the Content with formatting in a webform.
Is there any solution?
Please help me.

Thanks in advance.


Look it Up: Managing Directory Security Principals in the .NET Framework 3.5

  

Here's an overview of the new System.DirectoryServices.AccountManagement class in the .NET Framework 3.5 and how it simplifies working with directory services.

Joe Kaplan and Ethan Wilansky

MSDN Magazine January 2008


Got Directory Services?: New Ways to Manage Active Directory using the .NET Framework 2.0

  

System.DirectoryServices is a managed code layer on top of Active Directory Service Interfaces, and you can employ it to better manage Active Directory from your code. Here Ethan Wilansky helps you get started.

Ethan Wilansky

MSDN Magazine December 2005


.Net Framework zip package file

  
Has anyone idea about .net package files?? I seriously have no clue about this & have asked to do a POC on this. I am told that this feature has come up along with .Net Framework 3.5 but couldn't find any pointer after googling even. It would be great if somebody can explain this & its usage??

How to move a file from one domain to another domain?

  
The following code works as it was originally designed to move a file from one directory to another directory on the same server, but I need to change it to work so it will move a file from one server to another server.  My challenge is how to define the source directory on a different server and check if file exists. Please help.Code behind:Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click         Dim sFile, source, target, link As String         sFile = FileUpload1.FileName         source = "r:\storage\uploaded" & sFile         target = "r:\storage\" & DepartmentList.SelectedValue & "\" & InstructorList.SelectedValue & "\" & CourseNameList.SelectedValue & "\" & sFile         link = "http://someserver.com/upload/" & DepartmentList.SelectedValue & "/" & InstructorList.SelectedValue & "/" & CourseNameList.SelectedValue & "/" & sFile           'Start SelectedValue is not empty         If Not (DepartmentList.SelectedValue = "" Or InstructorList.SelectedValue = "" Or CourseNameList.SelectedValue = "

How to move PrincipalPermissionAttribute from CS file to app.config?

  
I'm really struggling with the following scenario: I have a WCF service where the methods of the implementation of my service contract are decorated with one, or many, PrincipalPermission attribute(s). For instance: [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")] [PrincipalPermission(SecurityAction.Demand, Role = "MyGroup_1")] public void DoSomething() { //Work done here } [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")] public void DoSomethingElse() { //Work done here } So in this case, method DoSomething(), could be called by users either members of the "Administrators" group or the "MyGroup_1" group. And only Administrators should be allowed to make calls to DoSomethingElse(). My problem is I want to put this in the app.config file, but I can't find any way to do this. How can I "move" these decorations from my CS file to the app.config?  

Framework error:Could not load file or assembly 'Microsoft.AnalysisServices, Version=9.0.242.0

  
Hi,I use sql clr sp's to load data in to database using .net framework 2.0. I never had aproblem using this and it went well for months.I recently updated to net framework 3.5 sp1 and sqlserver sp3 on 32-bit sql server and win 2003.I am facing an error which i could not resolve.Error:System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AnalysisServices, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050)System.IO.FileLoadException:    at StoredProcedures.checktable(String paramComponent, String paramParameters)I have gone through different forums, and trie different options,but did not help. I am using 'unsafe'  option.I also tried to alter assembly which is mentioned in http://support.microsoft.com/kb/949080/pt But when i tried to alter the assembly using the above link or try to change the permission to external access on the assembly, i get the below error.Alter ASSEMBLY AccessibilityFROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Accessibility.dll'Cannot alter the assembly 'Accessibility', because it does not exist or you do not have permission.I am an admin on the server/sqlCan some one suggest how to alter assembly with permissions or solve this issue or am i missing anything important.Do i

Directory lookup for the file failed with the operating system error 5

  
Hi I have a Windows desktop application that uses a SQLServer Express database.  The database files are downloaded from my website, followed by the application download (written in VBE).  The first procedure is to attach the database to the SQLServer instance from within the application. I have two test machines one runs Windows XP x84, the other Windows 7 x64.  I never have issues on attaching the database files in my test envirnoment but twice now other people downloading have got the following error System.Data.Sqlclient.sqlexception (ox 80131904) Directory lookup for the file C:\Documtents and Settings\Administrator\Desktop\Tem1.mdf failed with the operating system error 5 (failed to retrieve text for this error. Reason 1815) changed database context to 'master'. I'm not sure what the problem is and therefore how to correct the issue.  I attach the database in code using the create statement e.g. cmd7.CommandText = "USE Master CREATE DATABASE Tem1 ON PRIMARY (FILENAME = '" & DBFullPath & "') LOG ON (FILENAME = '" & DbLogPath & "') FOR ATTACH" Any help or suggestions would be very much appreciated. Chris    

how can i replace a file from a directory using file upload control and c# in a web applicatin

  
i m developing a web based appllication with asp.net and c#. I want to replace a file that is in a directory by code.

Creating Database gives error : "Directory lookup for the file "xxxxx.mdf" failed with the operating

  
Hello FriendsI am creating Database using SQLDMOcode is as follows... Code Snippet SQLServer2Class server = new SQLServer2Class();server.EnableBcp = true;server.Connect(WebConfigurationManager.AppSettings["ServerName"] ,WebConfigurationManager.AppSettings["UserName"],WebConfigurationManager.AppSettings["Password"]);DBFileClass dbFile = new DBFileClass();           dbFile.Name = dbName;          dbFile.PhysicalName = "C:\\" + dbName + ".mdf";          dbFile.Size = 300;          dbFile.FileGrowthType = SQLDMO_GROWTH_TYPE.SQLDMOGrowth_MB;          dbFile.FileGrowth = 25;          dbFile.PrimaryFile = true;          LogFile2Class dbLogFile = new LogFile2Class();          dbLogFile.Name = dbName + "_log";          dbLogFile.PhysicalName = "C:\\" + dbName + "_log.ldf";          dbLogFile.FileGrowthType = SQLDMO_GROWTH_TYPE.SQLDMOGrowth_Percent;          dbLogFile.FileGrowth = 10;          Database2Class newDb = new Database2Class();          newDb.Name = dbName;          newDb.FileGroups.Item("PRIMARY").DBFiles.Add((DBFile)dbFile);          newDb.TransactionLog.LogFiles.Add((_LogFile)dbLogFile);          server.Databases.Add((_Database)newDb); This Code Generates Following Error !!]Microsoft][ODBC SQL Server Driver][SQL Server]Directory lookup for the file "D:\Projects\my_system\mySys

FAQ: How do I listen to changes in a file/directory in the windows file system?

  
How do I listen to changes in a file/directory in the windows file system?Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

The file or directory is corrupted or unreadable

  

Hi,

I have installed a two node active/passive sql 2005 cluster on windows 2003 in vmware workstation environment . the cluster installed successfully (configured the cluster according to the link "http://www.bradspace.net/blog/kb/?p=91&more=1&c=1&tb=1&pb=1"). but when I try to move sql server resource group to passive node, it gets fail by logging following error message in event log "initerrlog: Could not open error log file 'G:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'. Operating system error = 1392(The file or directory is corrupted and unreadable.)."

I have taken sql resources group offline and manually moved only sql server shared drive to other node and i have found that i am not being able to access error log or any other folder including data on node 2. the operating system shows a error saying that disk is corrupted. I have run chkdsk which delete's all the files of sql setup.

I re-installed sql server, but again found the same problem . by wo

Opening vs2008 solution file in vs2010 - Framework targeting issue

  

Hey guys,

I am opening a vs2008 .sln file inside vs2010 - the conversion wizard shows up, and it goes through with no errors other than a pop up warning me that this solution needs .Net Framework 3.5 and that it is "not installed on this machine" - I chose to target it to .Net Framework 4.0 and to try to switch it later as an option.

I then bring up Properties - >Application -> Target Framework and in the dropdown, .Net Framework 3.5 is not listed - which is strange since in "Add or Remove Programs" I can see .Net Framework 3.5 is installed on my machine.

How can I get Framework 3.5 to show up in the dropdown so I can target this project to that framework?

Can't say I've ever done this, so I'm pretty sure I'm doing something wrong.

 

Update: I tried Method #1 here (http://blogs.msdn.com/b/robvi/archive/2004/02/17/75272.aspx) and I cannot see v3.5 - so where did it go? I'm confused why it is not in my registry but shows up in "Add or Remove Programs" list...

Thanks


Upgrading .net framework and server effect active directory

  

Hi All,

I want to ask some questions that i doubt.

Now currently, our project using active directory on vb.net 1.1 and server 2003. We will be upgrade to vb.net 3.5 and server 2008.

In this case, 1. We convert all vb.net 1.1 application to vb.net 3.5 and run on server 2003.

Then later on, 2. Our server will upgrade to server 2003 to server 2008.

I would linke to know after doing above two phase will effect on Active Directory code setting in our program.

Can I conver to 1 to 1 withut changing anything in vb.net and server?


The file or directory is corrupted or unreadable

  

Hi,

I have installed a two node active/passive sql 2005 cluster on windows 2003 in vmware workstation environment . the cluster installed successfully (configured the cluster according to the link "http://www.bradspace.net/blog/kb/?p=91&more=1&c=1&tb=1&pb=1"). but when I try to move sql server resource group to passive node, it gets fail by logging following error message in event log "initerrlog: Could not open error log file 'G:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'. Operating system error = 1392(The file or directory is corrupted and unreadable.)."

I have taken sql resources group offline and manually moved only sql server shared drive to other node and i have found that i am not being able to access error log or any other folder including data on node 2. the operating system shows a error saying that disk is corrupted. I have run chkdsk which delete's all the files of sql setup.

I re-installed sql server, but again found the same problem . by wo

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend