Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission Denied On IIS 5

Status
Not open for further replies.

RebelFox

Programmer
Jun 16, 2002
62
GB
Hi,

I have coded a simple server side .asp page to write to a log text file. It is the example shown on page 409 of the Wrox book, 'Beginning Active Server pages 3.0'.

My problem is that when I try to write or append to a text file in my application root directory I get a 'permission denied' error. Even when I attempt to create a file I get a 'permission denied' error.

At first I thought it was simply a question of setting the IIS5 'Virtual Directory' settings with a tick against the 'write' option. I have done this but still get a 'permission denied' error.

The create text file command is generating the error:-

set objFileTextStream = objMyFileSystemObject.CtreateTextFile("C:\WEB\logfile.txt")

If anybody can suggest where I'm going wrong I'd be grateful. Below is the code I am trying to get working.

--------

<%
' ----------------------
' Variable Declaraitions
' ----------------------
Dim strPathInfo1 'Variables For Path
Dim objFile, objFSO 'Variables to define file to read
Dim objFileTextStream 'Define channel to read file object
Const ForAppending = 8 'Define Stream Append

' --------------
' Initialisation
' --------------
'Set Path & File From Default App Directory & Known File
strPathInfo1 = Request.ServerVariables &quot;APPL_PHYSICAL_PATH&quot;) & &quot;logfile.txt&quot;

Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
'
' If Output File Exists
If objFSO.FileExists(strPathInfo1) Then
Set objFileTextStream = objFSO.OpenTextFile(strPathInfo1, ForAppending)
Else
Set objFileTextStream = objFSO.CreateTextFile(strPathInfo1)
End if


' ------------
' Main Process
' ------------
WriteToFile &quot;Testing&quot;
CloseLog

' --------------
' Sub Procedures
' --------------

' Write Line To File
Sub WriteToFile (strNewEntry)
Dim strLogEntry
strLogEntry = FormatDateTime(now) & &quot; - &quot; & strNewEntry
objFileTextStream.WriteLine strLogEntry
End Sub

' Close log File
Sub CloseLog()
objFileTextStream.Close
End Sub


 
You have to set the write access in both IIS and in explorer.
In explorer you give write access to the user everyone.
 
Hi,

thanks for responding but I'm still a little confused.
Do you mean Internet Explorer? I can't find the option to allow script writing. Can you explain where it is for me?

I presume you don't mean file explorer. I can write and update text files via an editor in my root directory so it seems more likely you mean internet explorer.

Regards

Roy
 
start ==> run ==> mmc.exe ==> console ==> add remove snap in ==> add ==> Internet Information Services ==> add ==> close ==> click on Internet Information Services ==> OK ==> on the left side browse to the default web side and then to the folder where you want to put your log ==> right click ==> properties ==> directory tab ==> check write.

In the Explorer (explorer.exe) browse to the folder you want to write your log to ==> left click ==> tab security ==> add the user Everyone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top