Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi i have a file and i make it hidden with this code
C#
File.SetAttributes(fileName, FileAttributes.Hidden);

but when you click show hidden file in windows it will be show this but i want when i click the button it show this file and when you show hidden files in windows, it don't show my file
how can i do it?
Posted
Comments
Richard MacCutchan 20-Nov-14 9:59am    
You cannot make a file completely hidden from everyone. If you have information that you want to hide then you should use encryption to secure it.
BillWoodruff 20-Nov-14 10:05am    
You can't do this without doing the kind of hack of Windows OS that you really don't want an app to do (probably trigger Virus Checkers). How about just hiding the file away in some strange place the average user will probably never go ?
Sergey Alexandrovich Kryukov 20-Nov-14 11:51am    
Is simply should not be done, and not needed to be done. However, your "hiding the file away in some strange place" is not really a good advice. It evokes recollection of this Wikipedia page I agree with: Security through obscurity. Isn't that reasonable?
—SA
Philippe Mori 20-Nov-14 20:32pm    
I would say that files that user should normally not see should be put inside a subdirectory of user local application data folder.

It is easy to get those special locations in .NET and you would typically append have a folder with your company name under it. Depending on how many application you have and how many file you can have, you might have subfolder for your products and/or to group some related files together.

1 solution

Hidden is just an attribute - the file will and can be seen - so the simple answer is: you can't (system hacking aside)
 
Share this answer
 
Comments
Avenger1 20-Nov-14 10:55am    
no i don't want to hack
when that file is in downloading i want my user can't delete or move it to when download done
Best Regards

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