473,465 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

getting an absolute path

PJ6
Is it possible to get the absolute path (i.e. C:\inetpub\wwwroot) of the IIS
root directory?

And yes, I do need to get the actual, absolute path, because the Crystal
Reports XI web viewer does - the ReportSource property... get this... does
not understand relative paths.

Paul
Nov 20 '05 #1
3 1949
Server.MapPath("~/bla") etc..


"PJ6" <no****@nowhere.net> schreef in bericht
news:OF*************@TK2MSFTNGP10.phx.gbl...
Is it possible to get the absolute path (i.e. C:\inetpub\wwwroot) of the
IIS root directory?

And yes, I do need to get the actual, absolute path, because the Crystal
Reports XI web viewer does - the ReportSource property... get this... does
not understand relative paths.

Paul

Nov 20 '05 #2
<%@ page language="VB" %>
<script runat="server">
Public Sub Page_Load(Sender As System.Object, E As System.EventArgs)
Dim root as String = Server.MapPath("/")
Label1.Text = root
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Root Path</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

See it working at : http://asp.net.do/test/rootpath.aspx

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"PJ6" <no****@nowhere.net> wrote in message news:OF*************@TK2MSFTNGP10.phx.gbl...
Is it possible to get the absolute path (i.e. C:\inetpub\wwwroot) of the IIS root
directory?

Nov 20 '05 #3

Server.MapPath("~/") will return the base directory for an application.
Server.MapPath("/") will return the base directory for the root directory.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dl**********@azure.qinip.net...
Server.MapPath("~/bla") etc..
"PJ6" <no****@nowhere.net> schreef in bericht
news:OF*************@TK2MSFTNGP10.phx.gbl...
Is it possible to get the absolute path (i.e. C:\inetpub\wwwroot) of the IIS root
directory?

And yes, I do need to get the actual, absolute path, because the Crystal Reports XI web
viewer does - the ReportSource property... get this... does not understand relative
paths.

Paul


Nov 20 '05 #4

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

Similar topics

4
by: dchaffin | last post by:
I'm having a problem using file_exists with an absolute path and I can not figure out why. I tried the exact example that is on www.php.net ... <?php $filename = '/path/to/foo.txt'; if...
11
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
2
by: mhadi | last post by:
Hi All, I am developing a solutions for clients to run some webpages. Since there is no webserver the ASP route is a No Go. So I am using Javascript to connect to my database. The Problem is that...
3
by: JeffDotNet | last post by:
I wrote a small data processing application that writes a summary of several hundred files. I use drag and drop on a panel (Panel1) to grab the absolute path to each of these files. Then I begin...
4
windows_mss
by: windows_mss | last post by:
When I Select Source & Destination Dynamically, Path Getting Scatter Across The Map... hi, i can able to get the Correct Route and Path for the corresponding Source and destination, like...
6
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...
2
by: Stef Mientki | last post by:
hello, I'm trying to convert the links in html pages to absolute links, these pages can either be webpages or files on local harddisk (winXP). Now I've struggling for a while, and this code...
13
by: lawpoop | last post by:
Hello all - I have a two part question. First of all, I have a website under /home/user/www/. The index.php and all the other website pages are under /home/user/www/. For functions that are...
0
by: BruceMcF | last post by:
On Apr 16, 6:03 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
1
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...
0
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.