views:

12

answers:

1

I am using Windows 2003 and have an IIS website.

I created a file called test.asp in the c:\inetpub\wwwroot directory with the following contents:

<html>
  <body>
    <p>This is the text in the text file:</p>
    <%
    Set fs = Server.CreateObject("Scripting.FileSystemObject")
    set f = fs.CreateTextFile(Server.MapPath("testread.txt"), true)
    Response.Write("This Worked!")
    f.Close

    Set f = Nothing
    Set fs = Nothing
    %>
  </body>
</html>

When I view the page, I get the generic "Page cannot be displayed" which makes me think that there is an error in my script. I have tracked it down to the CreateTextFile function, it somehow fails.

My First question:

Is there anyway to debug this? I don't know how to view errors with this page, I always just get the "Page cannot be displayed".

Second question:

I don't know if there might be some sort of permissions issue? I tried setting the permissions of the Scripting.FileSystemObject key in registry to full control for EVERYONE.

I don't know what else could be preventing me from writing a file? I have verified that I can read a file with no problems.

A: 

If you're using Internet Explorer make sure you have the following setting unchecked:

Tools -> Options -> Advance Tab -> Show Friendly HTTP error messages

The next thing to check is that the anonymous account for the site has write access to the c:\inetpub\wwwroot folder.

In IIS6, to find the site's anonymous account:

Open IIS MMC by clicking -

Start -> Settings -> Control Panel -> Administrative Tools  
                           -> Internet Information Services (IIS) Manager

Browse and select the Default Web Site then right click and select Properties. On the tabbed dialogue select the Directory Security tab.

Click the Edit button in the Authentication and access control panel. Note the value in the User name field (whatever you do don't alter this). Click the Cancel button twice to dismiss these dialogues.

In explorer right click and open the properties of c:\inetpub\wwwroot. Select the Security tab and make sure that the anonymous account noted above is added and has at the very least Modify permissions.

Kev