?
Solved

Access Web.config in ASP .NET Web Application from seperate Class Library Project

Posted on 2005-02-24
5
Medium Priority
?
1,120 Views
Last Modified: 2008-01-09
So I have this hierarchy:

+ Solution
|
|--- + Class Library Project
|     |
|     |--- LogError.vb
|
|--- + ASP .NET Web Application
      |
      |--- Web.config

I want to access from Web.config:

<appSettings>
       <add key="sqlConnString" value="myDBString">
</appSettings>

from LogError.vb. Anyone know how I would go about doing this?
0
Comment
Question by:bradtm
5 Comments
 
LVL 3

Accepted Solution

by:
teejay21 earned 800 total points
ID: 13399624
ConfigurationSettings.AppSettings("sqlConnString")
0
 

Author Comment

by:bradtm
ID: 13399655
You can't access ConfigurationSettings.AppSettings from a seperate Class Library Project.
0
 
LVL 3

Expert Comment

by:teejay21
ID: 13399788
Yeah sorry - didn't see his comments "from LogError.vb".

0
 
LVL 1

Assisted Solution

by:jackrocks
jackrocks earned 800 total points
ID: 13399875
You can access teh web.config file from Class Project if you both the projects are in the same solution. ConfigurationSettings.AppSettings("sqlConnString") shoudl work.
0
 
LVL 4

Assisted Solution

by:kaliyappan_k
kaliyappan_k earned 400 total points
ID: 13400089
you have to reference the System.Configuration namespace to access it, and @jackrocks suggestion should work for you.

Cheers
Kaliyappan
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question