473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11344
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 ConfigurationSe ttings.AppSetti ngs or ConfigurationSe ttings.GetConfi g()? 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 ConfigurationSe ttings.AppSetti ngs or
ConfigurationSe ttings.GetConfi g()? 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 ConfigurationSe ttings.AppSetti ngs or
ConfigurationSe ttings.GetConfi g()? 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
1800
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 in the following way:
10
1916
by: bradtm | last post by:
So I have this hierarchy: + Solution | |--- + Class Library Project | | | |--- LogError.vb | |--- + ASP .NET Web Application |
1
4882
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 denied. Here is the server setup that we have: Dev - Development Computer on WinXP Pro SP2 (IIS5), VS2003 developing under .NET Framework 1.1 Server1 - Web Server on Win2003 Server (IIS6) Server2 - File Server on Win2003 Server
10
2540
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 the code itself. How can I have the dll read a app.config or web.config file for data? The information I'm looking to store in the file is servernames, file locations, etc. thanks
0
968
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. btw, my bo contains app.config and my bo is a seperate project. Is there a settings which will allow to use only the data from app.config instead of web.config.?
6
2418
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 web.config and change our connection strings to point to development databases, and change "debug=true". Before we deploy, we change everything back. We can't dynamically select the proper connection string in code because we are using the...
1
5136
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 that users will be working with 99% of the time, the other is a seperate "maintenance" executable. The connection string is stored via My.Settings (encrypted of course). The problem is that obviously with 2 different .exe there are 2 seperate...
7
2194
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
2924
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: string dbCs = ConfigurationManager.ConnectionStrings.ConnectionString; This code failed and generates an exception because (it seems) that the web.config is available only in the folder where it is. So what is the solution for Access to a...
0
8399
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
8827
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
8732
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...
0
7337
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...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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();...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1622
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.