all groups > dotnet security > june 2005 >
You're in the

dotnet security

group:

security exception trying to download a file from an ftp server


security exception trying to download a file from an ftp server Caroline
6/30/2005 1:30:02 PM
dotnet security: I get "An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll" when I try to download a csv file to my local drive
from an ftp server. I've played around with the .NET Configuration tool and
granted trust to mscorlib. I've granted FileIO write permissions and Socket
Permissions in my ap. I've shared the folder. I'm new to the .Net security
model, and I'm drowning in documentation. Could anyone point me in the right
Re: security exception trying to download a file from an ftp server Nicole Calinoiu
7/3/2005 10:22:26 AM
UnauthorizedAccessException usually indicates a problem with the user's NTFS
permissions, not the code's CAS permissions. Are you sure the user account
under which your code is running has adequate permissions to save the file
to the target path? If so, might the problem be that you are attempting to
overwrite a read-only file or a file that is in use by another process? If
not, could you please provide the full exception details (as output by its
ToString method)?



[quoted text, click to view]

Re: security exception trying to download a file from an ftp serve Caroline
7/5/2005 6:04:04 AM


[quoted text, click to view]

I can download a file to the target path from the command prompt under the
user account. Here are the full exception details:

An unhandled exception of type 'System.Exception' occurred in
PrinzenWeights.exe

Additional information: System.UnauthorizedAccessException: Access to the
path "C:\Weights" is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy)

Thank you,

Caroline
Re: security exception trying to download a file from an ftp serve Nicole Calinoiu
7/5/2005 9:29:10 AM
It looks like the exception details dump you pasted was truncated. If
possible, I'd like to see the full stack trace listing. (Amongst other
potential issues, it's a bit weird that the path referenced by the exception
message is "C:\Weights", a directory path as opposed to a file path.) It
would also be helpful if you could post a minimum relevant extract of the
code in which this happens, indicating the line on which the exception is
thrown.



[quoted text, click to view]

Re: security exception trying to download a file from an ftp serve Caroline
7/6/2005 11:10:07 AM


[quoted text, click to view]

Nicole,

You were helpful. Turns out my problem was just a silly oversight. Thank
you.

Caroline
[quoted text, click to view]
AddThis Social Bookmark Button