473,394 Members | 1,866 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,394 software developers and data experts.

Getting path of running codebehind ?

wl
Hi,

For an asp.net application I would like to store the DB connectionstring to
be used in a configuration file.
I know I can use the web.config file for this (and know how to read from
it). However, because I have my asp.net application hosted all codebehind
DLL's need to be put into the same BIN directory.

Therefore I would like to store the db configuration string for each
application into it's own configuration file. This configuration file could
have the same name (and be in the same BIN directory) as the codebehind DLL,
but with another file extention (XML instead of DLL).

eg: \BIN directory
project1.dll
project1.xml
project2.dll
project2.xml
Does anyone know how I can do this:
1. getting the absolue path of the codebehind DLL
2. reading from this file ?

Thanks in advance,

Wim
Nov 19 '05 #1
2 1260
Hi wl,

You can store each application in a separate folder and in this folder put a web.config file containing the respective connection string.

\bin\ <DLL's>

MyApp1\MyApp1 <files>
MyApp1\MyApp1 web.config

MyApp2\MyApp2 <files>
MyApp2\MyApp2 web.config

Guillermo G.

--------------------------------------------------------------------------------
Guillermo González Arroyave :: MCP ASP.Net C# :: DCE4

"wl" <so***@nospam.please> wrote in message news:Og**************@TK2MSFTNGP15.phx.gbl...
Hi,

For an asp.net application I would like to store the DB connectionstring to
be used in a configuration file.
I know I can use the web.config file for this (and know how to read from
it). However, because I have my asp.net application hosted all codebehind
DLL's need to be put into the same BIN directory.

Therefore I would like to store the db configuration string for each
application into it's own configuration file. This configuration file could
have the same name (and be in the same BIN directory) as the codebehind DLL,
but with another file extention (XML instead of DLL).

eg: \BIN directory
project1.dll
project1.xml
project2.dll
project2.xml
Does anyone know how I can do this:
1. getting the absolue path of the codebehind DLL
2. reading from this file ?

Thanks in advance,

Wim
Nov 19 '05 #2
I'm not sure what you're looking for but:

AppDomain.CurrentDomain.BaseDirectory gets the AppBase of the application
which will be the parent directory of ~/bin in ASP.NET. You can also call
Assembly.GetExecutingAssembly().CodeBase to get the currently executing assembly's
location it was located by the assembly resolver.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,

For an asp.net application I would like to store the DB
connectionstring to
be used in a configuration file.
I know I can use the web.config file for this (and know how to read
from
it). However, because I have my asp.net application hosted all
codebehind
DLL's need to be put into the same BIN directory.
Therefore I would like to store the db configuration string for each
application into it's own configuration file. This configuration file
could have the same name (and be in the same BIN directory) as the
codebehind DLL, but with another file extention (XML instead of DLL).

eg: \BIN directory
project1.dll
project1.xml
project2.dll
project2.xml
Does anyone know how I can do this:
1. getting the absolue path of the codebehind DLL
2. reading from this file ?
Thanks in advance,

Wim


Nov 19 '05 #3

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

Similar topics

2
by: Hayato Iriumi | last post by:
Hello, I have a need to kill a process. It sounds each enough, but the problem is that I have multiple executables running from different paths. Say, I have MyService.exe running from C:\FolderA...
1
by: Craig | last post by:
Hi I was wondering how to get the path that a DLL is running from (from a method within that DLL, e.g. it's own install path))? I have a web app with two modules. I'd like one of them to be able...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
9
by: Microsoft News Server | last post by:
Hi, I am currently having a problem with random, intermittent lock ups in my ASP.net application on our production server (99% CPU usage by 3 threads, indefinately). I currently use IIS Debug...
2
by: Jeff | last post by:
I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in the eNPTest02 directory of my localhost on my development machine. The database is on the web. ...
3
by: Deepson Thomas | last post by:
The below is error message : The type 'page2' already contains a definition for 'txtLocationName' i know why this comes. but iam not ablke to find the other place where the definition is added....
5
by: GaryDean | last post by:
I have a 1.1 asp.net project that has been converted by the conversion wizard. By and large the app runs allright except for one page... On one of the .aspx pages, the code behind file is not...
0
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form...
4
by: tkpmep | last post by:
I've just bought an iMac (OS X 10.5.2, will almost immediately jump to 10.5.3), and am looking to install Python on it, and to use it with XCode, Apple's IDE. Some googling suggests that a number...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.