Now I use the following code:
Public Function SetACL(ByVal filename As String, ByVal account As String, ByVal sender As Object, ByVal e As System.EventArgs) As Boolean
Try
Dim rule As FileSystemAccessRule = New FileSystemAccessRule(account, FileSystemRights.Write, AccessControlType.Allow)
Dim fp As Pe...
The MSDN constructor for a FileStream says that it may throw either an UnauthorizedAccessException or a SecurityException. Here's what MSDN says about these exceptions.
UnauthorizedAccessException:
The exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error.
Security...
I have a pretty simple client-server ASP.NET app; communication is via WCF service. All worked perferctly inVS 2008, now I upgraded to VS2010 and every time the client code is trying to instantiate a channel to the server:
new ChannelFactory<IMemberService>("Members.MemberService").CreateChannel();
it throws an UnauthorizedAccessExcep...
I created a desktop application using VS 2008.
When I run it locally, all works well.
I shared my output folder (WITHOUT allowing network users to change my files)
and ran my exe from another Vista computer on our intranet.
When running the shared exe, I receive "System.UnauthorizedAccessException" when trying to read a file.
How ca...