how to change one element of machine.config into web.config?

D

Dan

H,

i want to use for one specific application the default membership provider
as defined by default in machine.config, except one element: i want to use
requiresUniqueEmail="false" instead of the default configuration in
machine.config (which is set on "true").

So i did this in the web.config of the application:
<membership defaultProvider="MyMembershipProvider">
<providers>
requiresUniqueEmail="true"
/>
</providers>
</membership>

but this generates the error: "The configuration section cannot contain a
CDATA or text element."

if i put
<add name=" ..."
i also have to put: "Type"
and also the connectionstring

and then i have to add the section
<connectionStrings>


Do i have to copy the entire membership section of the machine.config into
web.config + section <connectionStrings>
and change the element "requiresUniqueEmail", or it can shorter?

Thanks
Dan
 
K

Kevin Spencer

You have to remove the provider you want to change and then re-add it, as
in:

<membership defaultProvider="SqlPageContentMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<remove name="MyMembershipProvider"/>
<add name="MyMembershipProvider"
type="DsiGlobal.AspNetControls.SqlMembershipProvider"
connectionStringName="WebContentConnectionString"
applicationName="appName"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="false"
passwordFormat="Encrypted"/>
</providers>
</membership>

You can also use <clear /> to remove all the Membership Providers, and then
add it back in. Remember that essentially, the providers element represents
a NameValueCollection, so you treat it like one.
--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
D

Dan

Thanks for replying,

so if i understand good, if i want to change only one property of the
default provider (like requirersUniqueEmail), i have to remove the provider,
then to add it back and redifine all other properties + also define a new
connectionstring with <connectionstrings></connectionstrings> element
(because there is no one in web.config).
Is this correct?
If yes, a lot of work for just changing a "true" in "false", don't you think
so?
 
K

Kevin Spencer

so if i understand good, if i want to change only one property of the
default provider (like requirersUniqueEmail), i have to remove the
provider, then to add it back and redifine all other properties + also
define a new connectionstring with <connectionstrings></connectionstrings>
element (because there is no one in web.config).
Is this correct?

As I said, the configuration section exposes an underlying Collection.
However, there is no interface for changing any of the properties of the
members via the configuration file. But there is a configuration interface
for removing and adding members, so that is what you do. Yes. That's
correct.
If yes, a lot of work for just changing a "true" in "false", don't you
think so?

You've spent more time talking about it than it takes to do it, so, no I
don't think it's a lot of work.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
D

Dan

Ok, thanks for your advice ... and time

Kevin Spencer said:
As I said, the configuration section exposes an underlying Collection.
However, there is no interface for changing any of the properties of the
members via the configuration file. But there is a configuration interface
for removing and adding members, so that is what you do. Yes. That's
correct.


You've spent more time talking about it than it takes to do it, so, no I
don't think it's a lot of work.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top