RE: REPOST - web.config and web parts.
From: Daniel Larson (www.portalbuilder.org) (daniel_at_larsontechnology.spamfree.com)
Date: 11/08/04
- Next message: Dickran: "Assigning tasks to groups?"
- Previous message: Daniel Larson (www.portalbuilder.org): "RE: have sql on a different box"
- In reply to: Marc Jennings: "RE: REPOST - web.config and web parts."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Nov 2004 09:59:03 -0800
Marc,
Make sure that your config files have "config" extensions rather than ".Xml"
extensions or they will be served up through the website, potentially
creating a security risk.
Also, based on your description, you may want to simply link to an xml file
that contains the appSettings tag and appSettings entries like this:
in web.config:
<appSettings file="appSettings.config"></appSettings>
appSettings.config:
<appSettings>
<add key="key" value="value" />
<add key="key2" value="value2" />
</appSettings>
...and then you can simply access them through:
System.Configuration.ConfigurationSettings.AppSettings["key"];
...which returns the string "value".
Daniel Larson
www.portalbuilder.org
"Marc Jennings" wrote:
> Thanks all. This is essentially what I have done now. the Web.Config file
> contains one entry in appSettings that points to a file location. The web
> part then parses the xml config document and uses xpath to pull out the
> string it needs.
>
> If anyone needs the source to do something similar, let me know (although I
> can't guarantee you won't laugh at my "l337 sk1llz" ;-)
>
> "Wei-Dong XU [MSFT]" wrote:
>
> > Hi Marc,
> >
> > Since SPS/WSS site is one asp.net site essentially, the configuration file
> > for one SPS/WSS site should only be web.config. If you are going to add
> > your own value, you will have to put them in the <appsettings> section and
> > retrieve them via the classes under System.Configuration.
> >
> > For this restriction, if you are going to add your own configuration file.
> > I'd suggest you can put one file under the specified folder as you wish and
> > load the file at runtime with System.IO and analysis the xml content with
> > the classes under System.XML. You will need to write code for access the
> > file and obtain the information. Furthermore, since this file is totally
> > under control of your code, you can also store your web part information
> > into the file when necessary.
> >
> > In addition, for your own configuration file, as the suggestion from Deyra,
> > I'd also suggest you can create one folder in the server for your
> > configuration files so that no matter which site the customer put your web
> > part into. They can always work well.
> >
> > Please feel free to let me know if you have any question.
> >
> > Best Regards,
> > Wei-Dong XU (WD)
> > Microsoft Product Support Services
> > Get Secure! - www.microsoft.com/security
> > This posting is provided "AS IS" with no warranties, and confers no rights
- Next message: Dickran: "Assigning tasks to groups?"
- Previous message: Daniel Larson (www.portalbuilder.org): "RE: have sql on a different box"
- In reply to: Marc Jennings: "RE: REPOST - web.config and web parts."
- Messages sorted by: [ date ] [ thread ]