Finding absolute file path on server?

P

Paul

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
 
E

Evertjan.

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()
 
P

Paul

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

%>
 
P

Paul

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
 
E

Evertjan.

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top