Hi all *.*
I want to know if a file is readonly or not please tell me how to do that (Csharp )
How To know if a File Is readOnly ?
Urgent
Urgent :How To know if a File Is readOnly ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Vandita PandeyRank #3,390 · 425 reputationPosted Aug 14, 2006, 4:33 AM EDT
Using GetAttributes method you can check the fileattributes of a file.
Check the code snippet below :
string path = @"c:\temp\MyTest.txt";
// Ensure that the file is readonly.
if ((File.GetAttributes(path) & FileAttributes.ReadOnly)== FileAttributes.ReadOnly)
{
// some code here
}