streamwriter

S

stringy

Why could it be that i am able to use StreamWriter from a
windows application but not from a web application?

I am getting an unauthorizedaccessexception and the
exception message is "Access to the path... is denied".

the code i'm using is very straightforward:

using System.IO;
.....
StreamWriter sw = new StreamWriter(@"C:\Testing123.txt");
sw.Write("web");
sw.Close();

i am baffled.

Is this a security issue?

thank you in advance..
 
C

Carlos J. Quintero [.NET MVP]

The Web application is executed under other credentials (the ASPNET user
account), which may lack privileges outside its temp folder.

BTW, this group is for VB.NET, not for C# ;-)

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Q

Q

Hello Stringly,

remember that in webapplications, your code is executed on the server.
So, in your example, are you sure which C-drive you are refering to???

Regards,

Q
 

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