Creating a file and saving it to C
-
I am trying to create a simple text file and save it to C as: File.Create(C:/Points.txt) I am getting this error: System.UnauthorizedAccessException was unhandled Message="Access to the path 'C:\\Points.txt' is denied." Source="mscorlib" StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, etc. Can anyone tell me why? Its my computer and I am the sole user and administrator. Thanks
-
I am trying to create a simple text file and save it to C as: File.Create(C:/Points.txt) I am getting this error: System.UnauthorizedAccessException was unhandled Message="Access to the path 'C:\\Points.txt' is denied." Source="mscorlib" StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, etc. Can anyone tell me why? Its my computer and I am the sole user and administrator. Thanks
Interesting, I tried and got the same error. Then I tried with Notepad and I got the same error as well. Seems to be one of those path were you need to be really the administrator (as in, if you said yes to an UAC prompt)
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
-
I am trying to create a simple text file and save it to C as: File.Create(C:/Points.txt) I am getting this error: System.UnauthorizedAccessException was unhandled Message="Access to the path 'C:\\Points.txt' is denied." Source="mscorlib" StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, etc. Can anyone tell me why? Its my computer and I am the sole user and administrator. Thanks
-
I am trying to create a simple text file and save it to C as: File.Create(C:/Points.txt) I am getting this error: System.UnauthorizedAccessException was unhandled Message="Access to the path 'C:\\Points.txt' is denied." Source="mscorlib" StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, etc. Can anyone tell me why? Its my computer and I am the sole user and administrator. Thanks
Vista doesn't allow writing to the root directory; get a better operating system (XP). Better yet, store application data in the application data directory.
-
I had absolutely no trouble doing this on XP, not even a warning. So I guess you're not using XP
-
Vista doesn't allow writing to the root directory; get a better operating system (XP). Better yet, store application data in the application data directory.
-
Trouble with storing in the application directory is then you have to have the user browse to where he stored the application so you can pick up the path. Better than random locations on C I suppose.
The application data directory.
-
Hy, 3 options: 0) Disable the UAC or play with it until W7 will let you copy on root(c:\) without the UAC prompt. 1) Implement a UAC like button or something for this purpose Here's an example on how to bypass the UAC 2) Use the application folder I highly recommed nr 2)
modified on Tuesday, April 6, 2010 10:56 PM
-
Hy, 3 options: 0) Disable the UAC or play with it until W7 will let you copy on root(c:\) without the UAC prompt. 1) Implement a UAC like button or something for this purpose Here's an example on how to bypass the UAC 2) Use the application folder I highly recommed nr 2)
modified on Tuesday, April 6, 2010 10:56 PM