472,373 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

How to get Full Path of current directory ? (ASP.net)

Hi,

I want to retrieve the complete full path to the directory
of my current page but i don't find how to do that.
For example i want : D:\myWebSite\firstDotNetWebApp\dir1\

I tried "AppDomain.CurrentDomain.BaseDirectory" but it's
return only the path to my WebApplication, ex :
D:\myWebSite\firstDotNetWebApp\

Some how to do that ?

thx
Nov 18 '05 #1
3 25497
SSW
Server.MapPath("MyWebSite");

HTH

Thanks,

sswalia

"PHaroZ" <se*****************@douane.finances.gouv.fr> wrote in message
news:0b****************************@phx.gbl...
Hi,

I want to retrieve the complete full path to the directory
of my current page but i don't find how to do that.
For example i want : D:\myWebSite\firstDotNetWebApp\dir1\

I tried "AppDomain.CurrentDomain.BaseDirectory" but it's
return only the path to my WebApplication, ex :
D:\myWebSite\firstDotNetWebApp\

Some how to do that ?

thx

Nov 18 '05 #2
"PHaroZ" wrote...
Some how to do that ?


Server.MapPath( Path)

** Copied from a search in Visual Studio for mappath **

For the examples below, the file Data.txt is located in the directory,
C:\Inetpub\Wwwroot\Script, along with the Test.asp file that contains the
following scripts. The C:\Inetpub\Wwwroot directory is set as the server's
home directory.

The following example uses the server variable PATH_INFO to map the physical
path of the current file.

<%= Server.MapPath(Request.ServerVariables("PATH_INFO" ))%><BR>

The preceding script produces the following output:

c:\inetpub\wwwroot\script\test.asp<BR>

Because the path parameters in the following examples do not start with a
slash character, they are mapped relative to the current directory, in this
case C:\Inetpub\Wwwroot\Script.

<%= Server.MapPath("data.txt")%><BR>
<%= Server.MapPath("script/data.txt")%><BR>

The preceding scripts produce the following output:

c:\inetpub\wwwroot\script\data.txt<BR>
c:\inetpub\wwwroot\script\script\data.txt<BR>

The next two examples use the slash characters to specify that the path
returned should be looked up as complete virtual paths on the server.

<%= Server.MapPath("/script/data.txt")%><BR>
<%= Server.MapPath("\script")%><BR>

The preceding scripts produce the following output:

c:\inetpub\wwwroot\script\data.txt<BR>
c:\inetpub\wwwroot\script<BR>

The following examples demonstrate how you can use either a forward slash
(/) or a backslash (\) to return the physical path to the home directory of
the Web site root.

<%= Server.MapPath("/")%><BR>
<%= Server.MapPath("")%><BR>

The preceding scripts produce the following output:

c:\inetpub\wwwroot<BR>
c:\inetpub\wwwroot<BR>

The following example demonstrates how you can use relative paths to return
the relative physical path to the page that is being viewed in the Web
browser.

<%= Server.MapPath("../")%><BR>
<%= Server.MapPath("..")%><BR>

Hope this helps.

Regards

Rob
Nov 18 '05 #3
Jos
Server.MapPath(".")

--

Jos
Nov 18 '05 #4

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

Similar topics

8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
2
by: Anders Bornholm | last post by:
I have the following setup: A website that is completely accessible to a logged-in user. Access control is handled by a third-party external module implemented as an ISAPI filter. The...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
4
by: tommaso.gastaldi | last post by:
Hi friends I was in the need to find a sort of "definitive" :) solution to transform a virtual path such as "~/MyDir/MyFile into a full web address. In particular I needed it * within web...
7
by: gmax2006 | last post by:
Hi, I use RedHat linux. How can I find where exactly the current python script is running? I use this code: #test.py import os,sys
1
by: xeroxero | last post by:
With Framework 2.0, what is the best way to get the current full URI of the web application? For example, if a user goes to http://mysite.com/place/subdir and the virtrual directory (web app)...
1
by: jalupinu | last post by:
My OS is Winxp SP2 and the software I am having trouble with is Maximizer 9.5 Enterprise. It has a Web Portal feature that i am trying to use and followed the instructions to set it up however I keep...
4
by: Michel Rouzic | last post by:
I made a program that accepts as parameters an input file name that we'll call file1, and an output file name that we'll call file2, and opens on its own a configuration file called file3. My...
65
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.