Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 04, 2013 04:40 PM by Ruchira
Jan 02, 2013 03:01 PM|LINK
I am trying to debug a web application through an IIS web site on my local machine.
I am copying contents from an xml file to another on my local c:\ drive.
And this works fine when I use the ASP.net built in web server but now that I have created my project as an IIS 5.1 web site and
am stepping through its code in debug mode I don't have access rights to this file any more.
His is obviously an IIS safety feature but how to I grant premission and to which account do I grant this permission to ?
Thanks for your insights !
Jan 02, 2013 03:15 PM|LINK
see this article http://support.microsoft.com/kb/271071
Jan 02, 2013 04:07 PM|LINK
Thanks for your answer.
I am not sure where to begin with the article.
Here is the line of code which I want to execute from within my asp.net code behind StreamWriter wr = new StreamWriter(@"c:/capture.xml");
Here is the error :
System.UnauthorizedAccessException was unhandled by user code
Message=Access to the path 'c:\capture.xml' is denied.
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path)
Who doesn't have access ? The web site the asp.net ? IIS security data ?
Jan 02, 2013 08:02 PM|LINK
Check this link...
Jan 04, 2013 11:05 AM|LINK
Try to copy xml into a file which is inside your website domain or web project folder. By default asp.net won't allow you to save or move file outside the domain .
Jan 04, 2013 04:40 PM|LINK
You should give permission to IUSR. My blogpost will help you with that.
Please 'Mark as Answer' if this post helps you.