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

How to access web.config from seperate project in the same solution?

Good morning. I have a solution set up with multiple projects. One
is a web project and it contains my web.config file. I would like to
build a class within another project (a class library) that is in the
same solution that can read values from the app settings section of
that web config file. Is there a way to do that? I've got the class
written that will read web.config in the same project, but can't get
it to read from a different project. Thanks for your help!
Nov 18 '05 #1
4 11329
Why not use XML classes in .NET? web.config is nothing but xml anyway. (at least for now).

--
Girish Bharadwaj
http://msmvps.com/gbvb
Good morning. I have a solution set up with multiple projects. One
is a web project and it contains my web.config file. I would like to
build a class within another project (a class library) that is in the
same solution that can read values from the app settings section of
that web config file. Is there a way to do that? I've got the class
written that will read web.config in the same project, but can't get
it to read from a different project. Thanks for your help!


Nov 18 '05 #2
Hello Girish,

Oh my god... You cannot be serious...

Why not use ConfigurationSettings.AppSettings or ConfigurationSettings.GetConfig()? I've done this repeatedly with class libraries that are referenced from a web project.

--
Matt Berther
http://www.mattberther.com
Why not use XML classes in .NET? web.config is nothing but xml anyway.
(at least for now).
Good morning. I have a solution set up with multiple projects. One
is a web project and it contains my web.config file. I would like to
build a class within another project (a class library) that is in the
same solution that can read values from the app settings section of
that web config file. Is there a way to do that? I've got the class
written that will read web.config in the same project, but can't get
it to read from a different project. Thanks for your help!


Nov 18 '05 #3
I did not know if that class library was going to be hosted within that
web site..

--
Girish Bharadwaj
http://msmvps.com/gbvb
Hello Girish,

Oh my god... You cannot be serious...

Why not use ConfigurationSettings.AppSettings or
ConfigurationSettings.GetConfig()? I've done this repeatedly with
class libraries that are referenced from a web project.

--
Matt Berther
http://www.mattberther.com
Why not use XML classes in .NET? web.config is nothing but xml
anyway. (at least for now).
Good morning. I have a solution set up with multiple projects. One
is a web project and it contains my web.config file. I would like
to build a class within another project (a class library) that is in
the same solution that can read values from the app settings section
of that web config file. Is there a way to do that? I've got the
class written that will read web.config in the same project, but
can't get it to read from a different project. Thanks for your
help!


Nov 18 '05 #4
I agree AppSettings is what I thought of first. But, then I could not figure out if that project was hosted or not. For e.g. if you are writing a installer assembly, you will endup using XML classes to read and modify the web.config. That is the reason I suggested what I suggested. (of course, I also assumed that the poster had already tried AppSettings).

--
Girish Bharadwaj
http://msmvps.com/gbvb
Hello Girish,

Oh my god... You cannot be serious...

Why not use ConfigurationSettings.AppSettings or
ConfigurationSettings.GetConfig()? I've done this repeatedly with
class libraries that are referenced from a web project.

--
Matt Berther
http://www.mattberther.com
Why not use XML classes in .NET? web.config is nothing but xml
anyway. (at least for now).
Good morning. I have a solution set up with multiple projects. One
is a web project and it contains my web.config file. I would like
to build a class within another project (a class library) that is in
the same solution that can read values from the app settings section
of that web config file. Is there a way to do that? I've got the
class written that will read web.config in the same project, but
can't get it to read from a different project. Thanks for your
help!


Nov 18 '05 #5

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

Similar topics

2
by: Emilio Jimonerz | last post by:
Hello. I am developing a project tracking database that records the following information: 1. Project name 2. Lead person(s) 3. Support person(s) 4. Clients 5. Contacts The data is organized...
10
by: bradtm | last post by:
So I have this hierarchy: + Solution | |--- + Class Library Project | | | |--- LogError.vb | |--- + ASP .NET Web Application |
1
by: Jody Gelowitz | last post by:
We are having an issue in that when trying to read a file that is on Server2 from Server1 (through our ASP.NET project), we receive the error: Access to the path "\\Server2\MyShare\MyFile.tif" is...
10
by: NuB | last post by:
I'm creating a C# class file(DLL) that will be used by an asp.net application. In the DLL I want to read a web.config, or app.config file so some information can change without having to go into...
0
by: sree | last post by:
Hi, My solution contains a web service, business object, windows service etc... when the web service calls my business object(bo), the bo reads data from web.config instead of App.config file. ...
6
by: Joel H | last post by:
We have several settings in web.config that are different on the developer side than the production side. Our website sourcecode is under sourcesafe control, so before we code, we check out the...
1
by: Matt F | last post by:
Two of the projects in my solution that both need to use a common user.config file. This is a data application - the executable that is created with the first project is the primary executable...
7
by: Tony K | last post by:
How can I customize, at runtime, the path for the OLEDB connection uses. I used the Add Data Source Wizard and found the path set by the wizard is ReadOnly.
3
by: skneife | last post by:
I have a Solution that contains a website and its web.config and another project named testWebSite. I need to access to the web.*config located in the website project from testWebSite like this:...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...

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.