|
|
|
start date: Wed, 08 Aug 2007 09:22:46 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
unknown
|
|
2
Peter Bromberg [C# MVP]
|
web.config to hold control specific variables
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#.
Date:Wed, 08 Aug 2007 09:22:46 -0700
Author:
|
RE: web.config to hold control specific variables
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/tutorials/aspnet/e54f2d32-72c4-4d2b-b180-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
"mattgarvin@hotmail.com" wrote:
> 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#.
>
>
Date:Wed, 8 Aug 2007 10:46:07 -0700
Author:
|
|
|