Finding absolute file path on server?

Discussion in 'ASP General' started by Paul, Mar 17, 2006.

  1. Paul

    Paul Guest

    I am trying to create a log of certain events on the website by writing them
    to a text file. The logging code is in an "included" file that is inserted
    into the pages that need to be monitored. Currently, the target text file is
    just specified in the FSO MapPath as "thelog.txt", so it writes the log to a
    text file within the same folder as the web page.

    The problem is that I don't want to grant browsers Write access to my pages
    folder, so I need to have a separate directory to hold the log text file
    that browsers can have Write access to. The web site is hosted on a shared
    server that I do not have direct access to. In the past, occasionally an
    error has popped up that states the exact location, but I can not get that
    to repeat. I know it is something like "D:\customers\myuserid\www\"

    How can I find out the actual location on the server so I can use an
    absolute path to write all the logs to one file in one location?

    Thanks.
    Paul
    Paul, Mar 17, 2006
    #1
    1. Advertising

  2. Paul

    Evertjan. Guest

    Paul wrote on 17 mrt 2006 in microsoft.public.inetserver.asp.general:

    > The problem is that I don't want to grant browsers Write access to my
    > pages folder, so I need to have a separate directory to hold the log
    > text file that browsers can have Write access to.


    How would you give server directory write access to a browser?

    Only by giving the browser html form submitting the specification of the
    directory.

    ASP code resideas on the server and can have write access wherever you
    like, without the browser having such access privilege.

    So simply write correct and safe ASP vbs or js code.

    Absolute path is found with server.mappath()

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Mar 17, 2006
    #2
    1. Advertising

  3. Paul

    Paul Guest

    Found what I needed, log is working now. Here is what I found, in case
    anyone else has the same problem.

    <%
    Dim ServerPath

    ServerPath =Server.MapPath(".")

    Response.Write ServerPath

    %>

    "Paul" <> wrote in message
    news:...
    >I am trying to create a log of certain events on the website by writing
    >them to a text file. The logging code is in an "included" file that is
    >inserted into the pages that need to be monitored. Currently, the target
    >text file is just specified in the FSO MapPath as "thelog.txt", so it
    >writes the log to a text file within the same folder as the web page.
    >
    > The problem is that I don't want to grant browsers Write access to my
    > pages folder, so I need to have a separate directory to hold the log text
    > file that browsers can have Write access to. The web site is hosted on a
    > shared server that I do not have direct access to. In the past,
    > occasionally an error has popped up that states the exact location, but I
    > can not get that to repeat. I know it is something like
    > "D:\customers\myuserid\www\"
    >
    > How can I find out the actual location on the server so I can use an
    > absolute path to write all the logs to one file in one location?
    >
    > Thanks.
    > Paul
    >
    Paul, Mar 17, 2006
    #3
  4. Paul

    Paul Guest

    Evertjan,

    Thank you for replying. You must have posted at the same time I did.

    My server control panel has a tool to set what level of permission that
    browsers have. It allows none, read, read/write, or read/write/delete for
    any user, including anonymous browsers.

    I'm still trying to figure the permissions side of things out, as now I have
    removed all access for browsers yet it functions properly. That fits your
    statement about ASP code not requiring browser access privilege. However,
    the odd thing is that an administrative user with full RWD privileges is
    getting Permission Denied errors on the same script.

    Paul

    "Evertjan." <> wrote in message
    news:Xns9789D7181C03Deejj99@194.109.133.242...
    > Paul wrote on 17 mrt 2006 in microsoft.public.inetserver.asp.general:
    >
    >> The problem is that I don't want to grant browsers Write access to my
    >> pages folder, so I need to have a separate directory to hold the log
    >> text file that browsers can have Write access to.

    >
    > How would you give server directory write access to a browser?
    >
    > Only by giving the browser html form submitting the specification of the
    > directory.
    >
    > ASP code resideas on the server and can have write access wherever you
    > like, without the browser having such access privilege.
    >
    > So simply write correct and safe ASP vbs or js code.
    >
    > Absolute path is found with server.mappath()
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
    Paul, Mar 17, 2006
    #4
  5. Paul

    Evertjan. Guest

    Paul wrote on 17 mrt 2006 in microsoft.public.inetserver.asp.general:

    [please do not toppost on usenet]

    > Thank you for replying. You must have posted at the same time I did.
    >
    > My server control panel has a tool to set what level of permission
    > that browsers have. It allows none, read, read/write, or
    > read/write/delete for any user, including anonymous browsers.


    You are talking about permissions of internet or intranet connections.

    That is not the same as a browser permission. a browser permission is a
    clientside permission to access clientside HDs.

    > I'm still trying to figure the permissions side of things out, as now
    > I have removed all access for browsers yet it functions properly. That
    > fits your statement about ASP code not requiring browser access
    > privilege. However, the odd thing is that an administrative user with
    > full RWD privileges is getting Permission Denied errors on the same
    > script.


    You could change the standard permission set for the IIS owner, but I would
    in general not do that, exept for one directory, like a cgi directory.

    You could later forget what you had set them to, creating a security risk.

    Just choose the right directory for the task at hand.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Mar 17, 2006
    #5
  6. http://www.powerasp.com/content/hintstips/physical-path.asp

    "Paul" <> wrote in message
    news:...
    >I am trying to create a log of certain events on the website by writing
    >them to a text file. The logging code is in an "included" file that is
    >inserted into the pages that need to be monitored. Currently, the target
    >text file is just specified in the FSO MapPath as "thelog.txt", so it
    >writes the log to a text file within the same folder as the web page.
    >
    > The problem is that I don't want to grant browsers Write access to my
    > pages folder, so I need to have a separate directory to hold the log text
    > file that browsers can have Write access to. The web site is hosted on a
    > shared server that I do not have direct access to. In the past,
    > occasionally an error has popped up that states the exact location, but I
    > can not get that to repeat. I know it is something like
    > "D:\customers\myuserid\www\"
    >
    > How can I find out the actual location on the server so I can use an
    > absolute path to write all the logs to one file in one location?
    >
    > Thanks.
    > Paul
    >
    Kyle Peterson, Mar 20, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    3
    Views:
    19,500
    Sudsy
    Jul 8, 2004
  2. RonS
    Replies:
    5
    Views:
    4,392
  3. Replies:
    10
    Views:
    3,478
  4. James Byrne
    Replies:
    3
    Views:
    541
    James Byrne
    Sep 14, 2010
  5. Roy Smith
    Replies:
    1
    Views:
    312
    Gelonida N
    Jun 19, 2012
Loading...

Share This Page