I'm trying to store something like this in my web.config file:
<authInfoGroup>
<authInfo UserId="uid1" Passport="pwd1" Expiry="" />
<authInfo UserId="uid2" Passport="pwd2" Expiry="" />
</authInfoGroup>
To do so, I've created the following section in my web.config:
<configSections>
<sectionGroup name="authInfoGroup">
<section name="authInfo"
type="System.Configuration.SingleTagSectionHandler , System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</sectionGroup>
</configSections>
However, this fails and here's the error desc.:
Sections must only appear once per config file. See the help topic
<location> for exceptions
However, I need to keep the above-mentioned data in my web.config file; and
obviously, there are always more than one authInfo that I'm going to keep.
Any idea?
Thanks in advance,
Mehdi 5 11436
Change: <authInfoGroup> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfoGroup>
To:
<appSettings>
<add key="uid1" value="pwd1,"" />
<add key="uid2" value="pwd2,"" />
</appSettings>
Then, to retrieve the values in another file:
Dim UserInfo as string =
System.Configuration.ConfigurationSettings.AppSett ings("uid1")
You could then use various string methods to parse the value for the
password and/or expiration.
<me************@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl... I'm trying to store something like this in my web.config file:
<authInfoGroup> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfoGroup> To do so, I've created the following section in my web.config:
<configSections> <sectionGroup name="authInfoGroup"> <section name="authInfo" type="System.Configuration.SingleTagSectionHandler , System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup> </configSections>
However, this fails and here's the error desc.:
Sections must only appear once per config file. See the help topic <location> for exceptions
However, I need to keep the above-mentioned data in my web.config file; and obviously, there are always more than one authInfo that I'm going to keep.
Any idea?
Thanks in advance, Mehdi
This is the fast solution, but I need the one I described. Any idea?
"Scott M." <s-***@nospam.nospam> wrote in message
news:e#**************@TK2MSFTNGP11.phx.gbl... Change:
<authInfoGroup> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfoGroup>
To:
<appSettings> <add key="uid1" value="pwd1,"" /> <add key="uid2" value="pwd2,"" /> </appSettings>
Then, to retrieve the values in another file:
Dim UserInfo as string = System.Configuration.ConfigurationSettings.AppSett ings("uid1")
You could then use various string methods to parse the value for the password and/or expiration. <me************@hotmail.com> wrote in message news:OI**************@TK2MSFTNGP10.phx.gbl... I'm trying to store something like this in my web.config file:
<authInfoGroup> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfoGroup> To do so, I've created the following section in my web.config:
<configSections> <sectionGroup name="authInfoGroup"> <section name="authInfo" type="System.Configuration.SingleTagSectionHandler , System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup> </configSections>
However, this fails and here's the error desc.:
Sections must only appear once per config file. See the help topic <location> for exceptions
However, I need to keep the above-mentioned data in my web.config file; and obviously, there are always more than one authInfo that I'm going to
keep. Any idea?
Thanks in advance, Mehdi
I'm confused. Why do you "need" your solution, which doesn't work?
What is it about what I've showed you that won't work for you?
This is how you store user defined values in Web.Config and then retrieve
them.
<me************@hotmail.com> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl... This is the fast solution, but I need the one I described. Any idea?
"Scott M." <s-***@nospam.nospam> wrote in message news:e#**************@TK2MSFTNGP11.phx.gbl... Change:
> <authInfoGroup> > <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> > <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> > </authInfoGroup>
To:
<appSettings> <add key="uid1" value="pwd1,"" /> <add key="uid2" value="pwd2,"" /> </appSettings>
Then, to retrieve the values in another file:
Dim UserInfo as string = System.Configuration.ConfigurationSettings.AppSett ings("uid1")
You could then use various string methods to parse the value for the password and/or expiration. <me************@hotmail.com> wrote in message news:OI**************@TK2MSFTNGP10.phx.gbl... > I'm trying to store something like this in my web.config file: > > <authInfoGroup> > <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> > <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> > </authInfoGroup> > To do so, I've created the following section in my web.config: > > <configSections> > <sectionGroup name="authInfoGroup"> > <section name="authInfo" > type="System.Configuration.SingleTagSectionHandler , System, > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> > </sectionGroup> > </configSections> > > However, this fails and here's the error desc.: > > Sections must only appear once per config file. See the help topic > <location> for exceptions > > However, I need to keep the above-mentioned data in my web.config file; > and > obviously, there are always more than one authInfo that I'm going to keep. > > Any idea? > > Thanks in advance, > Mehdi > >
Try
<authInfoGroup>
<authInfos>
<authInfo UserId="uid1" Passport="pwd1" Expiry="" />
<authInfo UserId="uid2" Passport="pwd2" Expiry="" />
</authInfos>
</authInfoGroup>
And
<configSections>
<sectionGroup name="authInfoGroup">
<section name="authInfos"
type="System.Configuration.SingleTagSectionHandler , System,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
</sectionGroup>
</configSections>
The code in your class that implements IConfigurationSectionHandler
should then be able to move through the XmlNode.ChildNodes
collection inspecting each <authInfo>.
Hope this helps.
<me************@hotmail.com> wrote in message news:<OI**************@TK2MSFTNGP10.phx.gbl>... I'm trying to store something like this in my web.config file:
<authInfoGroup> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfoGroup> To do so, I've created the following section in my web.config:
<configSections> <sectionGroup name="authInfoGroup"> <section name="authInfo" type="System.Configuration.SingleTagSectionHandler , System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup> </configSections>
However, this fails and here's the error desc.:
Sections must only appear once per config file. See the help topic <location> for exceptions
However, I need to keep the above-mentioned data in my web.config file; and obviously, there are always more than one authInfo that I'm going to keep.
Any idea?
Thanks in advance, Mehdi
Missed the significance of SingleTagSectionHandler and had thought
your were writing your on implementation of
IConfigurationSectionHandler(which might be an idea?).
But try this setup
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="myCustomSection"
type="System.Configuration.SingleTagHandler,
System, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</configSections>
<myCustomSection mykey="myvalue" />
</configuration>
which comes from http://msdn.microsoft.com/library/de...et04222003.asp sy******@hotmail.com (MJ) wrote in message news:<64**************************@posting.google. com>... Try
<authInfoGroup> <authInfos> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfos> </authInfoGroup>
And
<configSections> <sectionGroup name="authInfoGroup"> <section name="authInfos" type="System.Configuration.SingleTagSectionHandler , System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup> </configSections>
The code in your class that implements IConfigurationSectionHandler should then be able to move through the XmlNode.ChildNodes collection inspecting each <authInfo>.
Hope this helps.
<me************@hotmail.com> wrote in message news:<OI**************@TK2MSFTNGP10.phx.gbl>... I'm trying to store something like this in my web.config file:
<authInfoGroup> <authInfo UserId="uid1" Passport="pwd1" Expiry="" /> <authInfo UserId="uid2" Passport="pwd2" Expiry="" /> </authInfoGroup> To do so, I've created the following section in my web.config:
<configSections> <sectionGroup name="authInfoGroup"> <section name="authInfo" type="System.Configuration.SingleTagSectionHandler , System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup> </configSections>
However, this fails and here's the error desc.:
Sections must only appear once per config file. See the help topic <location> for exceptions
However, I need to keep the above-mentioned data in my web.config file; and obviously, there are always more than one authInfo that I'm going to keep.
Any idea?
Thanks in advance, Mehdi This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Guinness Mann |
last post by:
I'm working in VS2003.NET, with C#.
I use app.config to store the connection string to my SQL Server. This
works fine.
Lately I've been taking work home where the connection string is...
|
by: msuk |
last post by:
All,
I have a app.config which contains repeating tags as shown below:
<filelist>
<file>
<filetype>xxx</filetype>
<hex>yyyy</hex>
</file>
|
by: tommy |
last post by:
hello everbody,
i write a little asp-application with forms-authentication.
i copy my aspx-files with web.config to my webspace and i get the
error above...
i tried to set the...
|
by: Søren Lund |
last post by:
Hello,
I have implemented a custom config section handler by implementing the
IConfigurationSectionHandler interface. I have registered this handler
in web.config and everything works fine ......
|
by: Adam Getchell |
last post by:
I'm attempting to write a custom Authentication module using http://www.15seconds.com/Issue/020417.htm
I looked at http://support.microsoft.com/default.aspx?scid=kb;EN-US;307996, but it doesn't...
|
by: Tabi |
last post by:
Hi,
I want to create a custom section in my web.config that can hold my custom
values. I created a section in web.config as written below.
<configSections>
<section name="myCustomSection"...
|
by: Luke Dalessandro |
last post by:
I have an application with the following layout
/root/
/root/Default.aspx
/root/web.config
/root/child/
/root/child/web.config
web.config has a custom configuration section "testSection"...
|
by: Stephen |
last post by:
Hi,
Is there a way to have conditional statements in app.config file?
I want to add keys, so that based on the args, appropriate keys are taken
from the config file and used in my app
Thanks,...
|
by: Wayne Sepega |
last post by:
I have a web.config in the root of my website, in the web.config I have
defined an HTTPModule that is to be loaded into any application under the
website. Also defined in the web config is a custom...
|
by: =?Utf-8?B?Q2h1Y2sgUA==?= |
last post by:
I replace a lot of web.config sections during compile.
I am having trouble with a custom section is it possible to replace a custom
section?
Error 44 web.config(1): error WDP00002:...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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,...
| | |