473,670 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Local Dir

How can I get the path of the virtual directory which an ASP.NET app is
running?

For example, on a page running at
http://localhost/myapp/someFolder/default.aspx, I want to extract JUST the
http://localhost/myapp/

what combination of Page.Requests does this?

thnx
Nov 18 '05 #1
3 1191
Hey,

Request.Applica tionPath will get you the virtual directory for the app.
Server.MapPath will get you the physical path

Response.Write( Request.Applica tionPath);
will return
/CodePlay
which is the actual virtual dir for my web app.
and
Response.Write( Server.MapPath( Request.Applica tionPath));
will return
c:\inetpub\wwwr oot\CodePlay
which is also correct physical path on hdd

Chao,

Hermit Dave

"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:ec******** ******@TK2MSFTN GP12.phx.gbl...
How can I get the path of the virtual directory which an ASP.NET app is
running?

For example, on a page running at
http://localhost/myapp/someFolder/default.aspx, I want to extract JUST the
http://localhost/myapp/

what combination of Page.Requests does this?

thnx

Nov 18 '05 #2
But what about

http://localhost/codeplay ???

thnx

"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message
news:OC******** ******@TK2MSFTN GP10.phx.gbl...
Hey,

Request.Applica tionPath will get you the virtual directory for the app.
Server.MapPath will get you the physical path

Response.Write( Request.Applica tionPath);
will return
/CodePlay
which is the actual virtual dir for my web app.
and
Response.Write( Server.MapPath( Request.Applica tionPath));
will return
c:\inetpub\wwwr oot\CodePlay
which is also correct physical path on hdd

Chao,

Hermit Dave

"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:ec******** ******@TK2MSFTN GP12.phx.gbl...
How can I get the path of the virtual directory which an ASP.NET app is
running?

For example, on a page running at
http://localhost/myapp/someFolder/default.aspx, I want to extract JUST the http://localhost/myapp/

what combination of Page.Requests does this?

thnx


Nov 18 '05 #3
how bout
Response.Write( Request.Url.Sch eme + "://" + Request.Url.Hos t +
Request.Applica tionPath);

That should sort you out....

Hermit Dave

"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
But what about

http://localhost/codeplay ???

thnx

"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message
news:OC******** ******@TK2MSFTN GP10.phx.gbl...
Hey,

Request.Applica tionPath will get you the virtual directory for the app.
Server.MapPath will get you the physical path

Response.Write( Request.Applica tionPath);
will return
/CodePlay
which is the actual virtual dir for my web app.
and
Response.Write( Server.MapPath( Request.Applica tionPath));
will return
c:\inetpub\wwwr oot\CodePlay
which is also correct physical path on hdd

Chao,

Hermit Dave

"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:ec******** ******@TK2MSFTN GP12.phx.gbl...
How can I get the path of the virtual directory which an ASP.NET app is running?

For example, on a page running at
http://localhost/myapp/someFolder/default.aspx, I want to extract JUST the http://localhost/myapp/

what combination of Page.Requests does this?

thnx



Nov 18 '05 #4

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

Similar topics

0
8594
by: Steffen | last post by:
Hi! I'm trying to access a EntityBean from a servlet via the bean's local home interface. The EJB and the Servlet are together in one .ear file and I'm using JBoss 3.2.3. I think the "<local-jndi-name>" in jboss-web.xml is wrong. But I don't know what to write there. I've searched for examples or other help, but I haven't found anything useful. Thanks for your help in advance!
0
2404
by: Bill Hernandez | last post by:
Hi, I've been writing software on the mac since 1987, but am brand new at unix/php/mysql, and that's where I'm headed so I'm reading everything I can get my hands on, but like anything else there's going to be a learning curve, that having been said... I followed the install instructions at http://entropy.ch , and was able to get mySql & php installed on my G4 -> (OSX 10.2.6) last night. I downloaded Navicat and setup a password for...
1
121525
by: jiing | last post by:
Now let me describe what I have done and my purpose: Originally, I want to user ports to install phpBB But I found that phpBB doesn't support mysql 5.x (but the ports installed mySQL 5.0.0 alpha) so I deinstall mysql5-server and mysql5-client And then I install mysql41-server and mysql41-client on FreeBSD 5.3 by ports but now , mysql is not workable
0
1655
by: Jan | last post by:
While building PHP 4.4.0 on a fresh installed FreeBSD 5.4 I get the following error: www# /bin/sh /usr/home/c/console/toolscon/web/2/php-4.4.0/libtool --silent --preserve-dup-deps --mode=compile gcc -Imain/ -I/usr/home/c/console/toolscon/web/2/php-4.4.0/main/ -DPHP_ATOM_INC -I/usr/home/c/console/toolscon/web/2/php-4.4.0/include -I/usr/home/c/console/toolscon/web/2/php-4.4.0/main -I/usr/home/c/console/toolscon/web/2/php-4.4.0...
9
2201
by: Stefan Turalski \(stic\) | last post by:
Hi, I done sth like this: for(int i=0; i<10; i++) {...} and after this local declaration of i variable I try to inicialize int i=0;
23
3993
by: Timothy Madden | last post by:
Hello all. I program C++ since a lot of time now and I still don't know this simple thing: what's the problem with local functions so they are not part of C++ ? There surely are many people who will find them very helpfull. gcc has them as a non-standard option, but only when compiling C language code, so I'm afraid there might be some obscure reason why local functions are not so easy to be dealt with in C++, which I do not yet know.
6
3619
by: Brad | last post by:
I have a win2003 server workstation with multiple webs, each web has it's own ip address. In VS2005, if I select to open an existing web site, select Local IIS, the dialog correctly displays a list of all of my webs, however if I attempt to open a site under and web other than localhost I receive the message: "Unable to open the Web 'http://localhost/anywebappname'. The Web 'http://localhost/anywebappname' does not exist" Obviously...
1
6126
by: orp | last post by:
We've been struggling on how to determine if a local user is already in a local group. We have code (C#) that creates a local user, if the user doesn't already exist. And, we have code (C#) that creates a local group, if the group doesn't already exist. Both of these work fine. Now, we need to check whether the local user is already in the local group or not. We have code (C#) that adds the local user to the local group, but we...
55
6206
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in C# in some way? Or maybe no, because it is similar to a global variable (with its scope restricted) which C# is dead against? Zytan
28
2546
by: cpluslearn | last post by:
Hi, I have a local class inside a function template. I am able to wrap any type in my local class. Is it legal C++? What type of class is Local? Is it a class template or regular class? Thanks in advance. --dhina --------------------------------------------------------------------------------------------------------------------------------------------- class Foo { public:
0
8469
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8903
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7419
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5684
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1794
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.