B
BLUE
I've created a folder named TestDir in my wwwroot and I've created the
associated virtual application from IIS management snap-in.
I've given full control to TestDir to:
IUSR, ASPNET, Network service, Anonimous access, Everyone, Users, VS
Developers
I've set write access and low application protection from IIS management
snap-in.
Please help me because I'm going crazy!
I get this exception:
System.UnauthorizedAccessException: Access to
'C:\WINDOWS\system32\TestOut.txt' denied.
in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
in 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)
in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, FileOptions options)
in System.IO.StreamWriter.CreateFile(String path, Boolean append)
in System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encoding, Int32 bufferSize)
in System.IO.StreamWriter..ctor(String path)
in WS.HelloWorldWS.HelloWorld()
The code contained in Test.asmx is this:
<%@ WebService Language="C#" Class="WS.HelloWorldWS" %>
using System.IO;
using System.Web.Services;
namespace WS
{
[WebService(Namespace="http://microsoft.com/webservices/")]
public class HelloWorldWS: WebService
{
[WebMethod]
public string HelloWorld()
{
using(StreamWriter sw = new StreamWriter("TestOut.txt"))
{
sw.WriteLine("Hello world");
return "Hello World";
}
}
}
}
Thanks,
Luigi.
associated virtual application from IIS management snap-in.
I've given full control to TestDir to:
IUSR, ASPNET, Network service, Anonimous access, Everyone, Users, VS
Developers
I've set write access and low application protection from IIS management
snap-in.
Please help me because I'm going crazy!
I get this exception:
System.UnauthorizedAccessException: Access to
'C:\WINDOWS\system32\TestOut.txt' denied.
in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
in 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)
in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, FileOptions options)
in System.IO.StreamWriter.CreateFile(String path, Boolean append)
in System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encoding, Int32 bufferSize)
in System.IO.StreamWriter..ctor(String path)
in WS.HelloWorldWS.HelloWorld()
The code contained in Test.asmx is this:
<%@ WebService Language="C#" Class="WS.HelloWorldWS" %>
using System.IO;
using System.Web.Services;
namespace WS
{
[WebService(Namespace="http://microsoft.com/webservices/")]
public class HelloWorldWS: WebService
{
[WebMethod]
public string HelloWorld()
{
using(StreamWriter sw = new StreamWriter("TestOut.txt"))
{
sw.WriteLine("Hello world");
return "Hello World";
}
}
}
}
Thanks,
Luigi.