Sunday, April 22, 2007

UnAuthorizedAcessException

UnAuthorizedAcessException Occurs when write operation is done on read only file or I/O Operation is performed on a directory.
On that note,the below line would throw UnAuthorizedAcessException
StreamWriter objSw = new StreamWriter("D:\\New Folder", true);
The correct usage would be
StreamWriter objSw = new StreamWriter("D:\\New Folder\\abc.txt" , true);

"The End" for now!
Catch me Later.
J