Click here to Skip to main content
15,891,942 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello All,
i want to develop a text file in c#.net that is read only
The another feature of that file is that if some body wants to copy it,message blinks that says u cant copy the selected file.I have searched too much over net but i cant get any solution.please help me how to make such a file
Posted
Comments
Toli Cuturicu 6-Sep-10 6:06am    
Reason for my vote of 1
Absurdity: read == copy

If you allow someone to open a text file and lets say you don't allow to copy the 'file', does that do any good? What were you trying to achieve here - not allowing anyone to copy content, just read?

Why I ask so, if you allow opening a text file then you are allowing to copy the 'content' and thus all your effort to not allow copying the 'file' goes into vain.

I doubt, there is some flaw in your logic or requirement. Pick correct control/flow.
 
Share this answer
 
Comments
Rajesh Sajjanar 6-Sep-10 9:07am    
Reason for my vote of 1
making text file read only means allowing user to read but user cannot copy the whole file
Rajesh Sajjanar 6-Sep-10 9:37am    
Reason for my vote of 1
Readonly file is to read the file and dont allow to copy file is to restrict the user from copying the whole file, yhe logic/ flow is correct, also posted answer is not an answer
Per Söderlund 8-Sep-10 1:22am    
Reason for my vote of 5
Agree on this one as well.
I dont think Rajesh can read between the lines and see the holes in the questions logic.
I don't think you can make a copy protected file.
If you don't want people to see what's inside your file you should encrypt it.
 
Share this answer
 
Comments
Rajesh Sajjanar 6-Sep-10 9:40am    
Reason for my vote of 1
Not an answer, pls post such statements as comment
amit2620 wrote:
i want to develop a text file in C#.net that is read only

Assuming you're creating a text file. See the following MSDN page for an example on changing file attributes:"File.SetAttributes Method"[^].

amit2620 wrote:
The another feature of that file is that if some body wants to copy it,message blinks that says u cant copy the selected file.I have searched too much over net but i cant get any solution.please help me how to make such a file

As far as I know, you cannot do that (you may encrypt the file, if you want to hide it's content).
 
Share this answer
 
Comments
Rajesh Sajjanar 6-Sep-10 9:39am    
Reason for my vote of 1
Not an answer
Kubajzz 6-Sep-10 10:10am    
Reason for my vote of 5
The best answer in my opinion
Per Söderlund 8-Sep-10 1:18am    
Reason for my vote of 5
Best answer,if it is read only someone can open it and use copy and paste on the content, encrypt it is the best thing here i believe.

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