getting an absolute path

P

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
 
J

Juan T. Llibre

<%@ 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
 
J

Juan T. Llibre

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

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top