473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Application location

I am writing an .net assembly that can be called from a windows
application or from a web application and need to know the location of
the application that it is running under to be able to load an
initialisation file that may be above the application folder.

It should be the folder the application was run from or in an ASP.net
application it should be the same as
Request.ServerVariables.RootFilePath but I need to get at it in
Global.asax when Request is unavailable.

Where can I get this info?
Nov 18 '05 #1
4 1126
Hi,

In which event you cant access
HttpContext.Current.Request.ApplicationPath. as far as i know you can
get it from application_start, Session_Start and
Application_BeginRequest.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Hi,

You can try HttpContext.Current.Server.MapPath("~").

Cosmin

"Chris" <fr*******@surf.to> wrote in message
news:57*************************@posting.google.co m...
I am writing an .net assembly that can be called from a windows
application or from a web application and need to know the location of
the application that it is running under to be able to load an
initialisation file that may be above the application folder.

It should be the folder the application was run from or in an ASP.net
application it should be the same as
Request.ServerVariables.RootFilePath but I need to get at it in
Global.asax when Request is unavailable.

Where can I get this info?

Nov 18 '05 #3
Server.MapPath does work inside the ASP application, thanks.
I've also discovered Path.GetFullPath which I call if Server isn't present.

Thanks

"Cosmin Marin" <no****@nospam.ro> wrote in message news:<#a**************@tk2msftngp13.phx.gbl>...
Hi,

You can try HttpContext.Current.Server.MapPath("~").

Cosmin

"Chris" <fr*******@surf.to> wrote in message
news:57*************************@posting.google.co m...
I am writing an .net assembly that can be called from a windows
application or from a web application and need to know the location of
the application that it is running under to be able to load an
initialisation file that may be above the application folder.

It should be the folder the application was run from or in an ASP.net
application it should be the same as
Request.ServerVariables.RootFilePath but I need to get at it in
Global.asax when Request is unavailable.

Where can I get this info?

Nov 18 '05 #4
Server.MapPath does work inside the ASP application, thanks.
I've also discovered Path.GetFullPath which I call if Server isn't present.

Thanks

"Cosmin Marin" <no****@nospam.ro> wrote in message news:<#a**************@tk2msftngp13.phx.gbl>...
Hi,

You can try HttpContext.Current.Server.MapPath("~").

Cosmin

"Chris" <fr*******@surf.to> wrote in message
news:57*************************@posting.google.co m...
I am writing an .net assembly that can be called from a windows
application or from a web application and need to know the location of
the application that it is running under to be able to load an
initialisation file that may be above the application folder.

It should be the folder the application was run from or in an ASP.net
application it should be the same as
Request.ServerVariables.RootFilePath but I need to get at it in
Global.asax when Request is unavailable.

Where can I get this info?

Nov 18 '05 #5

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

Similar topics

9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
6
by: Ollie Riches | last post by:
I understand the use of Application.DoEvents() to process all outstanding messages on the message queue in a winforms application if you have long running process on the UI thread. But can anyone...
2
by: mark | last post by:
Can't figure this one out. I appears to not be code related. After surfing my asp.net web app for a while 5 - 10 min. it fails to open any further connections to my access 2000 database. There...
0
by: mark | last post by:
Can't figure this one out. I appears to not be code related. After surfing my asp.net web app for a while 5 - 10 min. it fails to open any further connections to my access 2000 database. There...
0
by: coopdog | last post by:
This is a new issue as of an install to sp1 on vb express 2005. When I publish the application to my drive then I try to install it is wants to be installed from the same location as it was...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...
0
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.