Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone I want to create folder ftp server which is name "as#" but when i create "as#" name of folder is made "as".I dont know thats name is "as" instead of "as#"

What I have tried:

I tried this codes

FtpWebRequest requestDir = (FtpWebRequest)FtpWebRequest.Create(new Uri(@"ftp://localhost/s/as#" ));
requestDir.Method = WebRequestMethods.Ftp.MakeDirectory;
requestDir.Credentials = new NetworkCredential(name, pass);
requestDir.UsePassive = true;
requestDir.Timeout = -1;
requestDir.UseBinary = true;
requestDir.KeepAlive = false;
FtpWebResponse response = (FtpWebResponse)requestDir.GetResponse();
Stream ftpStream = response.GetResponseStream();

ftpStream.Close();
response.Close();
Posted
Updated 4-Aug-16 2:23am
Comments
[no name] 4-Aug-16 7:22am    
Query string - Wikipedia, the free encyclopedia[^], search for "#". ...the character # can be used to further specify a subsection (or fragment) of a document...

This one is better:
Uniform Resource Identifier - Wikipedia, the free encyclopedia[^]

And I suggest you do inspect uri for the following:
Uri uri= new Uri(@"ftp://localhost/s/as#");

1. Creating a folder with a # in it is a bad idea, in my opinion. You are likely to run into weird problems if you use special characters.
2. You can use UrlEncode to encode the special characters. HttpUtility.UrlEncode Method (System.Web)[^]
 
Share this answer
 
You need to URLEncode the special characters. In your case, use
C#
FtpWebRequest requestDir = (FtpWebRequest)FtpWebRequest.Create(new Uri(@"ftp://localhost/s/as%23"));
 
Share this answer
 
Comments
Sake562 5-Aug-16 1:10am    
also i have a bit problem related to letters.For instanca i have "ə ü ö "letters into my path , due to program display error when find out this letters

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900