Use of FSObject

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RobertoF

    Use of FSObject

    Thanks a lot for every suggestion.
    I'm a roockies in asp page.
    I'm trying to improve a internal counter. I'he found the code to
    manage it (very simple) but have problems with autorization.

    I give "IUSR_name" the autorization (read, write, change, ALL) on
    specific directory (phisical c:\inetpub\wwwr oot\counters) created to
    manage the counter (just this directory) as described in manual and
    reference. I did the same with "_web anonimous user" but the response
    is always the same:
    run-time error in Microsoft VBScript (0x800A0046)
    Authorization denied.

    Do you have some idea how to solve this problem.
    Thanks a lot
    Roberto
  • Jeff Cochran

    #2
    Re: Use of FSObject

    On 31 Mar 2004 04:16:35 -0800, roberto.franchi @trainingteam.c om
    (RobertoF) wrote:
    [color=blue]
    >Thanks a lot for every suggestion.
    >I'm a roockies in asp page.
    >I'm trying to improve a internal counter. I'he found the code to
    >manage it (very simple) but have problems with autorization.
    >
    >I give "IUSR_name" the autorization (read, write, change, ALL) on
    >specific directory (phisical c:\inetpub\wwwr oot\counters) created to
    >manage the counter (just this directory) as described in manual and
    >reference. I did the same with "_web anonimous user" but the response
    >is always the same:
    > run-time error in Microsoft VBScript (0x800A0046)
    > Authorization denied.
    >
    >Do you have some idea how to solve this problem.[/color]

    Post a code snippet, and the actual text of the error. As for your
    error code, this is the normal issue:



    Jeff

    Comment

    • Roberto Franchi

      #3
      Re: Use of FSObject

      Error
      ===> in this line "Set WriteTotals = ...."
      Error Details:
      Error Type: Microsoft VBScript runtime
      Associated Error Number: 800A0046
      Cause/Symptoms:
      A quick scan of the failing ASP file's contents reveals an object being
      creating programmaticall y using the inherent VBScript function
      CreateObject or the ASP Server object function Server.CreateOb ject with
      one of the following class strings:
      Scripting.FileS ystemObject
      Scripting.Dicti onary
      In addition, this file may attempt to create, access or delete other
      files on the server programmaticall y using an object reference created
      from the first class string mentioned above.


      Code used
      ============
      <%
      Dim x
      Dim FSObject
      Dim GetTotals
      Dim WriteTotals
      Dim PageEntry
      Dim PageHits()
      Dim PageName()
      Dim ThisPage
      'What page are we on?
      ThisPage = Request.ServerV ariables("URL")
      Set FSObject = CreateObject("S cripting.FileSy stemObject")
      Set GetTotals =
      FSObject.OpenTe xtFile("C:\Inet pub\wwwroot\cou nters\PageTotal s.txt",1,0)
      x=0
      While Not GetTotals.AtEnd OfStream
      ReDim preserve PageName(x)
      PageName(x) = GetTotals.ReadL ine
      If PageName(x) = ThisPage Then
      ReDim preserve PageHits(x)
      PageHits(x) = GetTotals.ReadL ine + 1
      DisplayCount = PageHits(x)
      x = x + 1
      Else
      ReDim preserve PageHits(x)
      PageHits(x) = GetTotals.ReadL ine
      x = x + 1
      End If
      Wend
      GetTotals.Close
      Set GetTotals = Nothing
      Set WriteTotals =
      FSObject.Create TextFile("C:\In etpub\wwwroot\c ounters\PageTot als.txt")
      x = 0
      For Each PageEntry In PageName
      WriteTotals.Wri teLine PageName(x)
      WriteTotals.Wri teLine PageHits(x)
      x = x + 1
      Next
      WriteTotals.Clo se
      Set WriteTotals = Nothing
      Set FSObject = Nothing

      Response.Write( "<font size=2><b>You are " & ThisPage & _
      " Page visitor number...</b></font><br>" & _
      DisplayCount & "</font>")
      %>

      ============
      For other info contact me .
      Thanks
      RobertoF

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...