Ask a Question related to ASP.NET General, Design and Development.
-
Steve C. Orr, MCSD #1
Re: File Access error - writing to .txt file
Normally web sites run under the ASPNET user account.
It appears that this account does not have write privileges to the file path
you've specified.
--
I hope this helps,
Steve C. Orr, MCSD
[url]http://Steve.Orr.net[/url]
"John Carnahan" <carnahan_j@msn.com> wrote in message
news:%23qjqQjXTDHA.1868@TK2MSFTNGP11.phx.gbl...System.IO.FileStream(fileName,> Using .net in aspx page with following code, and get a write error on the
> website, but everything works fine on the development machine.
> ----- code ----
> Dim counter As String = CType(logcount, String)
> Dim fileName As String = mPath + mFileName
> Dim Fs As System.IO.FileStream = Newaccess,> IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
>
> Try
> Dim Sw As System.IO.StreamWriter = New
> System.IO.StreamWriter(Fs)
> Sw.Write(counter)
> Sw.Flush()
> Sw.Close()
>
> -- error page returned from website ----
>
> Server Error in '/' Application.
> Access to the path
> "\\premfs6\sites\premium5\michaelcarlin\webroot\MC P\VisitCount2.txt" is
> denied.
>
> Stack Trace:
> [UnauthorizedAccessException: Access to the path
> "\\premfs6\sites\premium5\michaelcarlin\webroot\MC P\VisitCount2.txt" is
> denied.]
> System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
> System.IO.FileStream..ctor(String path, FileMode mode, FileAccessBoolean> FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,access)> bFromProxy) +859
> System.IO.FileStream..ctor(String path, FileMode mode, FileAccess> +43
> MCP._default.WriteLogCnt()
> MCP._default.Logger()
> MCP._default.Page_Load(Object sender, EventArgs e)
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +29
> System.Web.UI.Page.ProcessRequestMain() +724
>
>
Steve C. Orr, MCSD Guest
-
Writing a text file to the file system
Using Visual Studio C# When I ran the following code: System.IO; private void Button1_Click(object sender, System.EventArgs e) {... -
Error writing ACP file
I get an error when attempting to do a Paper Capture. Once the program reaches the "writing ACP file" I get an error. I feel certain the problem is... -
Setting the file permissions of a file I'm writing to
Is it possible to specify the permissions of a file I create when I: open ("FOO", "> ./bar") or die ("Could not create file"); Thanks in... -
writing XML file error
Hi, I get an error (Access to the path "C:\Inetpub\wwwroot\LE\SMS\Mesaj_One.xml" is denied.) when I do this: string filename... -
A failure occurred writing to the resources file. Access is denied. -- RESX file is locked? -- WHY?
Hi. This is an error that comes up fairly regularly when trying to run the "Rebuild All" command in a Solution that contains more than one... -
John Carnahan #2
Re: File Access error - writing to .txt file
Thanks Steve
"Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
news:O$fiKxXTDHA.1652@TK2MSFTNGP11.phx.gbl...path> Normally web sites run under the ASPNET user account.
> It appears that this account does not have write privileges to the filethe> you've specified.
>
> --
> I hope this helps,
> Steve C. Orr, MCSD
> [url]http://Steve.Orr.net[/url]
>
>
> "John Carnahan" <carnahan_j@msn.com> wrote in message
> news:%23qjqQjXTDHA.1868@TK2MSFTNGP11.phx.gbl...> > Using .net in aspx page with following code, and get a write error on> System.IO.FileStream(fileName,> > website, but everything works fine on the development machine.
> > ----- code ----
> > Dim counter As String = CType(logcount, String)
> > Dim fileName As String = mPath + mFileName
> > Dim Fs As System.IO.FileStream = New> access,> > IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
> >
> > Try
> > Dim Sw As System.IO.StreamWriter = New
> > System.IO.StreamWriter(Fs)
> > Sw.Write(counter)
> > Sw.Flush()
> > Sw.Close()
> >
> > -- error page returned from website ----
> >
> > Server Error in '/' Application.
> > Access to the path
> > "\\premfs6\sites\premium5\michaelcarlin\webroot\MC P\VisitCount2.txt" is
> > denied.
> >
> > Stack Trace:
> > [UnauthorizedAccessException: Access to the path
> > "\\premfs6\sites\premium5\michaelcarlin\webroot\MC P\VisitCount2.txt" is
> > denied.]
> > System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
> > System.IO.FileStream..ctor(String path, FileMode mode, FileAccess> Boolean> > FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,> access)> > bFromProxy) +859
> > System.IO.FileStream..ctor(String path, FileMode mode, FileAccess>> > +43
> > MCP._default.WriteLogCnt()
> > MCP._default.Logger()
> > MCP._default.Page_Load(Object sender, EventArgs e)
> > System.Web.UI.Control.OnLoad(EventArgs e) +67
> > System.Web.UI.Control.LoadRecursive() +29
> > System.Web.UI.Page.ProcessRequestMain() +724
> >
> >
>
John Carnahan Guest



Reply With Quote

