web.config to hold control specific variables

M

mattgarvin

Hello,
my company hosts many websites, and we want to add a Feedback Form
(like "Contact Us") that can be re-used on all of them just by
"dropping in" a new directory containing the code. My boss told me to
make it as modular as possible, and to make it a control we can just
drag on to a page. Then he went on vacation for a week. :)

I have been reading about web.config files, and thought I could
utilize one to contain the few items that will be site specific (like
where the style sheet is, and a few different questions unique to a
particular Feedback Form) which I could stick in the "AppSettings"
area of a "web.config" that I put in the directory containing the rest
of my code. That is, I was hoping to not have to modify each site's
Web.config, but instead employ my own in my own folder.

Yes, I am new to ASP.NET, and could be mis-interpreting things, but
the book I have been reading did make it seem like this was possible.
But I do not see how to do it. When I try to put my own web.config in
my own directory, it seems to be ignored. Or maybe I just don't know
the way to access its "AppSettings" keys which I have defined?

Thanks for any help that you can provide.

Matt G.
PS: I am using Visual Studio and programming this in C#.
 
G

Guest

Matt,
web.config is read at the application root folder level. So if you have a
subfolder that has your subfolder containing additional pages/ code and it is
not marked as an Application in IIS, then the web.config from the folder
above it will take precedence. You can however specify a file= atribute in
the main web.config's appSettings section and it will read your custom
appSettings as long as the file= attribute correctly points to your settings
include file.

See here for a short article on same
http://www.eggheadcafe.com/tutorial...180-c1f564b41f85/some-aspnet-20-configur.aspx

--Pete
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top