PDA

View Full Version : ایجاد و خواندن فایل در درایو C بدون دسترسی Admin



mahdi68
یک شنبه 19 آذر 1391, 22:21 عصر
سلام
من تو برنامم نیاز دارم کهیک فایل xml در یک پوشه در درایو C ذخیره کنم و بعدا برنامه از اون فایل استفاده کنه اما یک مشکلی دارم اونم این هست که سیستم عامل اجازه کپی کردن وخوندن فایل از درایو C نمیده و پیغام زیر نمیایش داده میشه

System.UnauthorizedAccessException was unhandled
HResult=-2147024891
Message=Access to the path 'C:\Test.xml' 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, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at Kirpi_in_school.Form1..ctor() in c:\Users\Mahdi\Desktop\Kirpi in school\Kirpi in school\Form1.cs:line 29
at Kirpi_in_school.Program.Main() in c:\Users\Mahdi\Desktop\Kirpi in school\Kirpi in school\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

ممنون میشم راهنماییم کنید مه چجوری این مشکل حل کنم