473,545 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding absolute file path on server?

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\m yuserid\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
Mar 17 '06 #1
5 6570
Paul wrote on 17 mrt 2006 in microsoft.publi c.inetserver.as p.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)
Mar 17 '06 #2
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" <no****@mydomai n.com> wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl...
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\m yuserid\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

Mar 17 '06 #3
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." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Paul wrote on 17 mrt 2006 in microsoft.publi c.inetserver.as p.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)

Mar 17 '06 #4
Paul wrote on 17 mrt 2006 in microsoft.publi c.inetserver.as p.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)
Mar 18 '06 #5
http://www.powerasp.com/content/hint...sical-path.asp

"Paul" <no****@mydomai n.com> wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl...
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\m yuserid\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

Mar 20 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
12357
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of the file myclass.class? Will this work if it's run from a relative path, like: java ../progs/myclass
11
2361
by: Fuzzyman | last post by:
What's the best, cross platform, way of finding out the directory a script is run from ? I've googled a bit, but can't get a clear answer. On sys.argv the docs say : argv is the script name (it is operating system dependent whether this is a full pathname or not). So this doesn't seem to be the answer.
1
3832
by: Sugapablo | last post by:
How can I find out the full directory path (i.e. c:\path\to\file) of a file? I'm logged into a server and the of course, I have an FTP directory root, but I need to know the absolute path. -- http://www.sugapablo.com <--music ] http://www.sugapablo.net <--personal ]
11
3736
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET...
15
2886
by: Nick K. | last post by:
I recently began maintenance work on a production web server that is located in the root directory of a web server. I moved this into a sub web on my local web server in order to do work on it. I found that there is an include file that references images: <img src = "/images/Header.gif" What worked correctly on the production server...
3
14028
by: Pooja Renukdas | last post by:
Hello, I have this web site where only two pages have to be secure pages and I need to call them using https, but since I have my development server and my production web server, I dont want to enter the absolute url like response.redirect("https://myProductionServer.com/SecurePage.aspx"), because when Im working in the development server...
19
5053
by: Jerry M. Gartner | last post by:
Greetings: What is the best way to resolve paths within a document regardless of what path it is opened under? For example: I have x.php and it contains <img src="images...">, (amongst other things, like php code), which resolves the correct image path when opened under / but when x.php is read into a file under /dir the image no longer...
6
3146
by: Jon Slaughter | last post by:
do I have to prefix every absolute path with document root to get it to work? For some reason I thought that prefixing a path with '/' or './' with make it absolute w.r.t to document root but I guess not? e.g., when I do include './Scripts/AddNav.php';
12
1861
by: Jeff | last post by:
As I'm learning PHP, I'm making a fair number of mistakes in syntax. In perl, you can turn on reading these errors from the browser by adding this: use CGI::Carp 'fatalsToBrowser'; Is there something like this in PHP? Or do I need to find the php.ini file and look to see where the error
0
7459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7803
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7411
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5965
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.