Question: "Access to path denied" message

V

VB Programmer

When I run this line:

Dim sw As New System.IO.StreamWriter(strFileName)

I get this error:

System.UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\MyWeb\Resources\Templates\MyPage.Html" 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) at System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize) 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) at
EarlyAlert3.EditHtml.cmdSave_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\MyWeb\EditHtml.aspx.vb:line 172

Any ideas?

Thanks.
 
V

VB Programmer

I gave the aspnet user account r/w/mod access to the dir and it worked.
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top