By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,086 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,086 IT Pros & Developers. It's quick & easy.

Get data from Local Web.config not machine.config

P: n/a
I have a app that uses several membership/role providers. I can list these
Providers with the code:
Dim rootWebConfig1 As Configuration
rootWebConfig1 =
WebConfigurationManager.OpenWebConfiguration(Reque st.ApplicationPath)
Dim section As New MembershipSection
section = rootWebConfig1.GetSection("system.web/membership")

Using the Immediate Window :

? section.Providers(0).Name
"AspNetSqlMembershipProvider"
? section.Providers(1).Name
"MemberProv1"
? section.Providers(2).Name
"ADProvider1"

As you can see I can list the providers but the Provider
AspNetSqlMembershipProvider" is in the machine.config I do not have control
over the machine config at all my sites so I want to get the Providers only
from the web.config in my application.

How do I do this.

Thank you
--
Jerry
Oct 22 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Jerry,

We can read the web.config directly. Please refer to my reply in this post:

http://thesource.ofallevil.com/commu...us/default.asp
x?dg=microsoft.public.dotnet.framework.aspnet&tid= 0e140c7e-d85d-47bc-bcba-52
35731b9edb&cat=en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&lang=en&cr=us&sloc
=&p=1

If it's not what you need please let me know and clarify your requirement.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can

improve the support we provide to you. Please feel free to let my manager
know what you think of the

level of service provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-

us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response

from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take

approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The

offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support Engineer by

contacting Microsoft Customer Support Services (CSS) at

http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Get data from Local Web.config not machine.config
| thread-index: Ack0dMPG5k4uZE29T5SP1nO/sd0qAQ==
| X-WBNR-Posting-Host: 65.55.21.8
| From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| Subject: Get data from Local Web.config not machine.config
| Date: Wed, 22 Oct 2008 11:34:06 -0700
| Lines: 29
| Message-ID: <97**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:78389
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I have a app that uses several membership/role providers. I can list
these
| Providers with the code:
| Dim rootWebConfig1 As Configuration
| rootWebConfig1 =
| WebConfigurationManager.OpenWebConfiguration(Reque st.ApplicationPath)
| Dim section As New MembershipSection
| section = rootWebConfig1.GetSection("system.web/membership")
|
|
|
| Using the Immediate Window :
|
| ? section.Providers(0).Name
| "AspNetSqlMembershipProvider"
| ? section.Providers(1).Name
| "MemberProv1"
| ? section.Providers(2).Name
| "ADProvider1"
|
| As you can see I can list the providers but the Provider
| AspNetSqlMembershipProvider" is in the machine.config I do not have
control
| over the machine config at all my sites so I want to get the Providers
only
| from the web.config in my application.
|
| How do I do this.
|
| Thank you
| --
| Jerry
|

Oct 23 '08 #2

P: n/a
Allen,

Thank you for your reply,

I was hopping that the Configuration objects would have some funcions that
only read the sections in the local config file only and not the machine
config. The Membership and role sections may contain passwords so I planned
to encript them in some installations. This would make using the xml reader
and stream reader more complax. If I cannot get a list of Membership and Role
providers only from the local config file I can put a list of the providers
in the appSettings section. This makes the application setup more complex but
may be necessary.

Thank you
--
Jerry
"Allen Chen [MSFT]" wrote:
Hi Jerry,

We can read the web.config directly. Please refer to my reply in this post:

http://thesource.ofallevil.com/commu...us/default.asp
x?dg=microsoft.public.dotnet.framework.aspnet&tid= 0e140c7e-d85d-47bc-bcba-52
35731b9edb&cat=en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&lang=en&cr=us&sloc
=&p=1

If it's not what you need please let me know and clarify your requirement.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can

improve the support we provide to you. Please feel free to let my manager
know what you think of the

level of service provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-

us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response

from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take

approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The

offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support Engineer by

contacting Microsoft Customer Support Services (CSS) at

http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Get data from Local Web.config not machine.config
| thread-index: Ack0dMPG5k4uZE29T5SP1nO/sd0qAQ==
| X-WBNR-Posting-Host: 65.55.21.8
| From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| Subject: Get data from Local Web.config not machine.config
| Date: Wed, 22 Oct 2008 11:34:06 -0700
| Lines: 29
| Message-ID: <97**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:78389
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I have a app that uses several membership/role providers. I can list
these
| Providers with the code:
| Dim rootWebConfig1 As Configuration
| rootWebConfig1 =
| WebConfigurationManager.OpenWebConfiguration(Reque st.ApplicationPath)
| Dim section As New MembershipSection
| section = rootWebConfig1.GetSection("system.web/membership")
|
|
|
| Using the Immediate Window :
|
| ? section.Providers(0).Name
| "AspNetSqlMembershipProvider"
| ? section.Providers(1).Name
| "MemberProv1"
| ? section.Providers(2).Name
| "ADProvider1"
|
| As you can see I can list the providers but the Provider
| AspNetSqlMembershipProvider" is in the machine.config I do not have
control
| over the machine config at all my sites so I want to get the Providers
only
| from the web.config in my application.
|
| How do I do this.
|
| Thank you
| --
| Jerry
|

Oct 23 '08 #3

P: n/a
Hi Jerry,

I really understand you may feel inconvenience that we cannot get
AspNetSqlMembershipProvider in an easier way. You're welcome to submit a
feedback here:

https://connect.microsoft.com/Visual...?wa=wsignin1.0

Our development team will take into consideration all suggestions and
feedback for future releases and updates. With efforts from customers, we
continue to make our products better.
Regards,
Allen Chen
Microsoft Online Support

--------------------
| Thread-Topic: Get data from Local Web.config not machine.config
| thread-index: Ack1Fa+36aDtinreT0GwbKzBZF9JKw==
| X-WBNR-Posting-Host: 207.46.192.207
| From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| References: <97**********************************@microsoft.co m>
<EQ**************@TK2MSFTNGHUB02.phx.gbl>
| Subject: RE: Get data from Local Web.config not machine.config
| Date: Thu, 23 Oct 2008 06:46:01 -0700
| Lines: 133
| Message-ID: <1F**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:78471
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Allen,
|
| Thank you for your reply,
|
| I was hopping that the Configuration objects would have some funcions
that
| only read the sections in the local config file only and not the machine
| config. The Membership and role sections may contain passwords so I
planned
| to encript them in some installations. This would make using the xml
reader
| and stream reader more complax. If I cannot get a list of Membership and
Role
| providers only from the local config file I can put a list of the
providers
| in the appSettings section. This makes the application setup more complex
but
| may be necessary.
|
| Thank you
| --
| Jerry
|
|
| "Allen Chen [MSFT]" wrote:
|
| Hi Jerry,
| >
| We can read the web.config directly. Please refer to my reply in this
post:
| >
| >
http://thesource.ofallevil.com/commu...us/default.asp
| >
x?dg=microsoft.public.dotnet.framework.aspnet&tid= 0e140c7e-d85d-47bc-bcba-52
| >
35731b9edb&cat=en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&lang=en&cr=us&sloc
| =&p=1
| >
| If it's not what you need please let me know and clarify your
requirement.
| >
| Regards,
| Allen Chen
| Microsoft Online Support
| >
| Delighting our customers is our #1 priority. We welcome your comments
and
| suggestions about how we can
| >
| improve the support we provide to you. Please feel free to let my
manager
| know what you think of the
| >
| level of service provided. You can send feedback directly to my manager
at:
| ms****@microsoft.com.
| >
| ==================================================
| Get notification to my posts through email? Please refer to
| http://msdn.microsoft.com/en-
| >
| us/subscriptions/aa948868.aspx#notifications.
| >
| Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
| where an initial response
| >
| from the community or a Microsoft Support
| Engineer within 1 business day is acceptable. Please note that each
follow
| up response may take
| >
| approximately 2 business days as the support
| professional working with you may need further investigation to reach
the
| most efficient resolution. The
| >
| offering is not appropriate for situations
| that require urgent, real-time or phone-based interactions or complex
| project analysis and dump analysis
| >
| issues. Issues of this nature are best handled working with a dedicated
| Microsoft Support Engineer by
| >
| contacting Microsoft Customer Support Services (CSS) at
| >
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| ==================================================
| This posting is provided "AS IS" with no warranties, and confers no
rights.
| --------------------
| | Thread-Topic: Get data from Local Web.config not machine.config
| | thread-index: Ack0dMPG5k4uZE29T5SP1nO/sd0qAQ==
| | X-WBNR-Posting-Host: 65.55.21.8
| | From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| | Subject: Get data from Local Web.config not machine.config
| | Date: Wed, 22 Oct 2008 11:34:06 -0700
| | Lines: 29
| | Message-ID: <97**********************************@microsoft.co m>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | Path: TK2MSFTNGHUB02.phx.gbl
| | Xref: TK2MSFTNGHUB02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:78389
| | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | I have a app that uses several membership/role providers. I can list
| these
| | Providers with the code:
| | Dim rootWebConfig1 As Configuration
| | rootWebConfig1 =
| | WebConfigurationManager.OpenWebConfiguration(Reque st.ApplicationPath)
| | Dim section As New MembershipSection
| | section = rootWebConfig1.GetSection("system.web/membership")
| |
| |
| |
| | Using the Immediate Window :
| |
| | ? section.Providers(0).Name
| | "AspNetSqlMembershipProvider"
| | ? section.Providers(1).Name
| | "MemberProv1"
| | ? section.Providers(2).Name
| | "ADProvider1"
| |
| | As you can see I can list the providers but the Provider
| | AspNetSqlMembershipProvider" is in the machine.config I do not have
| control
| | over the machine config at all my sites so I want to get the
Providers
| only
| | from the web.config in my application.
| |
| | How do I do this.
| |
| | Thank you
| | --
| | Jerry
| |
| >
| >
|

Oct 24 '08 #4

P: n/a
Solution.

The problem is the application Inheritance. The app get information from the
machine.config.
All membership providers in machine.config are added to the membership
providers in the local web.config.

To solve this use the <clear/tag in the Membership section this will clear
all inherited membership providers for the app.

<membership >
<providers >
<clear />
<add name="MemberProv1" applicationName="/myapp"
connectionStringName="MemConnection1" requiresQuestionAndAnswer="false"
minRequiredPasswordLength="3" requiresUniqueEmail="false"
minRequiredNonalphanumericCharacters="0" passwordStrengthRegularExpression=""
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add name="ADProvider1"
attributeMapUsername="sAMAccountName"
connectionStringName="ADConnectionString1" connectionUsername="rpaul"
connectionPassword="ajdoivmejr" enableSearchMethods="true"
type="System.Web.Security.ActiveDirectoryMembershi pProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</membership>
Then when I use:
Dim MemSection As New MembershipSection
Dim RoleSection As New RoleManagerSection
MemSection = rootWebConfig1.GetSection("system.web/membership")
RoleSection = rootWebConfig1.GetSection("system.web/roleManager")

RoleSection.Providers(0).Name or
Membership.Providers(0).Name

I will only get RoleProviders or Membership providers from my web.config

I will not use Providers from the machine config. in the app.

Thank you,

--
Jerry
"Allen Chen [MSFT]" wrote:
Hi Jerry,

I really understand you may feel inconvenience that we cannot get
AspNetSqlMembershipProvider in an easier way. You're welcome to submit a
feedback here:

https://connect.microsoft.com/Visual...?wa=wsignin1.0

Our development team will take into consideration all suggestions and
feedback for future releases and updates. With efforts from customers, we
continue to make our products better.
Regards,
Allen Chen
Microsoft Online Support

--------------------
| Thread-Topic: Get data from Local Web.config not machine.config
| thread-index: Ack1Fa+36aDtinreT0GwbKzBZF9JKw==
| X-WBNR-Posting-Host: 207.46.192.207
| From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| References: <97**********************************@microsoft.co m>
<EQ**************@TK2MSFTNGHUB02.phx.gbl>
| Subject: RE: Get data from Local Web.config not machine.config
| Date: Thu, 23 Oct 2008 06:46:01 -0700
| Lines: 133
| Message-ID: <1F**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:78471
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Allen,
|
| Thank you for your reply,
|
| I was hopping that the Configuration objects would have some funcions
that
| only read the sections in the local config file only and not the machine
| config. The Membership and role sections may contain passwords so I
planned
| to encript them in some installations. This would make using the xml
reader
| and stream reader more complax. If I cannot get a list of Membership and
Role
| providers only from the local config file I can put a list of the
providers
| in the appSettings section. This makes the application setup more complex
but
| may be necessary.
|
| Thank you
| --
| Jerry
|
|
| "Allen Chen [MSFT]" wrote:
|
| Hi Jerry,
| >
| We can read the web.config directly. Please refer to my reply in this
post:
| >
| >
http://thesource.ofallevil.com/commu...us/default.asp
| >
x?dg=microsoft.public.dotnet.framework.aspnet&tid= 0e140c7e-d85d-47bc-bcba-52
| >
35731b9edb&cat=en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&lang=en&cr=us&sloc
| =&p=1
| >
| If it's not what you need please let me know and clarify your
requirement.
| >
| Regards,
| Allen Chen
| Microsoft Online Support
| >
| Delighting our customers is our #1 priority. We welcome your comments
and
| suggestions about how we can
| >
| improve the support we provide to you. Please feel free to let my
manager
| know what you think of the
| >
| level of service provided. You can send feedback directly to my manager
at:
| ms****@microsoft.com.
| >
| ==================================================
| Get notification to my posts through email? Please refer to
| http://msdn.microsoft.com/en-
| >
| us/subscriptions/aa948868.aspx#notifications.
| >
| Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
| where an initial response
| >
| from the community or a Microsoft Support
| Engineer within 1 business day is acceptable. Please note that each
follow
| up response may take
| >
| approximately 2 business days as the support
| professional working with you may need further investigation to reach
the
| most efficient resolution. The
| >
| offering is not appropriate for situations
| that require urgent, real-time or phone-based interactions or complex
| project analysis and dump analysis
| >
| issues. Issues of this nature are best handled working with a dedicated
| Microsoft Support Engineer by
| >
| contacting Microsoft Customer Support Services (CSS) at
| >
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| ==================================================
| This posting is provided "AS IS" with no warranties, and confers no
rights.
| --------------------
| | Thread-Topic: Get data from Local Web.config not machine.config
| | thread-index: Ack0dMPG5k4uZE29T5SP1nO/sd0qAQ==
| | X-WBNR-Posting-Host: 65.55.21.8
| | From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| | Subject: Get data from Local Web.config not machine.config
| | Date: Wed, 22 Oct 2008 11:34:06 -0700
| | Lines: 29
| | Message-ID: <97**********************************@microsoft.co m>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | Path: TK2MSFTNGHUB02.phx.gbl
| | Xref: TK2MSFTNGHUB02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:78389
| | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | I have a app that uses several membership/role providers. I can list
| these
| | Providers with the code:
| | Dim rootWebConfig1 As Configuration
| | rootWebConfig1 =
| | WebConfigurationManager.OpenWebConfiguration(Reque st.ApplicationPath)
| | Dim section As New MembershipSection
| | section = rootWebConfig1.GetSection("system.web/membership")
| |
| |
| |
| | Using the Immediate Window :
| |
| | ? section.Providers(0).Name
| | "AspNetSqlMembershipProvider"
| | ? section.Providers(1).Name
| | "MemberProv1"
| | ? section.Providers(2).Name
| | "ADProvider1"
| |
| | As you can see I can list the providers but the Provider
| | AspNetSqlMembershipProvider" is in the machine.config I do not have
| control
| | over the machine config at all my sites so I want to get the
Providers
| only
| | from the web.config in my application.
| |
| | How do I do this.
| |
| | Thank you
| | --
| | Jerry
| |
| >
| >
|

Oct 24 '08 #5

P: n/a
Hi Jerry,

Glad to know that you've find the solution yourself. If there's no need to
use the configurations set in the machine.config it's a proper solution to
clear them in our web.config. If we have to use them probably we have to
read the web.config ourselves.
If you have other questions welcome to send them in the newsgroup. I'm
willing to help.

Regards,
Allen Chen
Microsoft Online Support

--------------------
| Thread-Topic: Get data from Local Web.config not machine.config
| thread-index: Ack16Xp0rZcz5lo/S9qLOrIx5oVB4Q==
| X-WBNR-Posting-Host: 207.46.192.207
| From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| References: <97**********************************@microsoft.co m>
<EQ**************@TK2MSFTNGHUB02.phx.gbl>
<1F**********************************@microsoft.co m>
<a6**************@TK2MSFTNGHUB02.phx.gbl>
| Subject: RE: Get data from Local Web.config not machine.config
| Date: Fri, 24 Oct 2008 08:02:05 -0700
| Lines: 252
| Message-ID: <33**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:78568
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Solution.
|
| The problem is the application Inheritance. The app get information from
the
| machine.config.
| All membership providers in machine.config are added to the membership
| providers in the local web.config.
|
| To solve this use the <clear/tag in the Membership section this will
clear
| all inherited membership providers for the app.
|
| <membership >
| <providers >
| <clear />
| <add name="MemberProv1" applicationName="/myapp"
| connectionStringName="MemConnection1" requiresQuestionAndAnswer="false"
| minRequiredPasswordLength="3" requiresUniqueEmail="false"
| minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression=""
| type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0,
| Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
| <add name="ADProvider1"
| attributeMapUsername="sAMAccountName"
| connectionStringName="ADConnectionString1" connectionUsername="rpaul"
| connectionPassword="ajdoivmejr" enableSearchMethods="true"
| type="System.Web.Security.ActiveDirectoryMembershi pProvider, System.Web,
| Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
| </providers>
| </membership>
|
|
| Then when I use:
| Dim MemSection As New MembershipSection
| Dim RoleSection As New RoleManagerSection
| MemSection = rootWebConfig1.GetSection("system.web/membership")
| RoleSection = rootWebConfig1.GetSection("system.web/roleManager")
|
| RoleSection.Providers(0).Name or
| Membership.Providers(0).Name
|
| I will only get RoleProviders or Membership providers from my web.config
|
| I will not use Providers from the machine config. in the app.
|
| Thank you,
|
|
|
| --
| Jerry
|
|
| "Allen Chen [MSFT]" wrote:
|
| Hi Jerry,
| >
| I really understand you may feel inconvenience that we cannot get
| AspNetSqlMembershipProvider in an easier way. You're welcome to submit
a
| feedback here:
| >
| https://connect.microsoft.com/Visual...?wa=wsignin1.0
| >
| Our development team will take into consideration all suggestions and
| feedback for future releases and updates. With efforts from customers,
we
| continue to make our products better.
| >
| >
| Regards,
| Allen Chen
| Microsoft Online Support
| >
| --------------------
| | Thread-Topic: Get data from Local Web.config not machine.config
| | thread-index: Ack1Fa+36aDtinreT0GwbKzBZF9JKw==
| | X-WBNR-Posting-Host: 207.46.192.207
| | From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| | References: <97**********************************@microsoft.co m>
| <EQ**************@TK2MSFTNGHUB02.phx.gbl>
| | Subject: RE: Get data from Local Web.config not machine.config
| | Date: Thu, 23 Oct 2008 06:46:01 -0700
| | Lines: 133
| | Message-ID: <1F**********************************@microsoft.co m>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | Path: TK2MSFTNGHUB02.phx.gbl
| | Xref: TK2MSFTNGHUB02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:78471
| | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Allen,
| |
| | Thank you for your reply,
| |
| | I was hopping that the Configuration objects would have some funcions
| that
| | only read the sections in the local config file only and not the
machine
| | config. The Membership and role sections may contain passwords so I
| planned
| | to encript them in some installations. This would make using the xml
| reader
| | and stream reader more complax. If I cannot get a list of Membership
and
| Role
| | providers only from the local config file I can put a list of the
| providers
| | in the appSettings section. This makes the application setup more
complex
| but
| | may be necessary.
| |
| | Thank you
| | --
| | Jerry
| |
| |
| | "Allen Chen [MSFT]" wrote:
| |
| | Hi Jerry,
| | >
| | We can read the web.config directly. Please refer to my reply in
this
| post:
| | >
| | >
| >
http://thesource.ofallevil.com/commu...us/default.asp
| | >
| >
x?dg=microsoft.public.dotnet.framework.aspnet&tid= 0e140c7e-d85d-47bc-bcba-52
| | >
| >
35731b9edb&cat=en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&lang=en&cr=us&sloc
| | =&p=1
| | >
| | If it's not what you need please let me know and clarify your
| requirement.
| | >
| | Regards,
| | Allen Chen
| | Microsoft Online Support
| | >
| | Delighting our customers is our #1 priority. We welcome your
comments
| and
| | suggestions about how we can
| | >
| | improve the support we provide to you. Please feel free to let my
| manager
| | know what you think of the
| | >
| | level of service provided. You can send feedback directly to my
manager
| at:
| | ms****@microsoft.com.
| | >
| | ==================================================
| | Get notification to my posts through email? Please refer to
| | http://msdn.microsoft.com/en-
| | >
| | us/subscriptions/aa948868.aspx#notifications.
| | >
| | Note: The MSDN Managed Newsgroup support offering is for non-urgent
| issues
| | where an initial response
| | >
| | from the community or a Microsoft Support
| | Engineer within 1 business day is acceptable. Please note that each
| follow
| | up response may take
| | >
| | approximately 2 business days as the support
| | professional working with you may need further investigation to
reach
| the
| | most efficient resolution. The
| | >
| | offering is not appropriate for situations
| | that require urgent, real-time or phone-based interactions or
complex
| | project analysis and dump analysis
| | >
| | issues. Issues of this nature are best handled working with a
dedicated
| | Microsoft Support Engineer by
| | >
| | contacting Microsoft Customer Support Services (CSS) at
| | >
| | >
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| | ==================================================
| | This posting is provided "AS IS" with no warranties, and confers no
| rights.
| | --------------------
| | | Thread-Topic: Get data from Local Web.config not machine.config
| | | thread-index: Ack0dMPG5k4uZE29T5SP1nO/sd0qAQ==
| | | X-WBNR-Posting-Host: 65.55.21.8
| | | From: =?Utf-8?B?SmVycnkgQw==?= <je*****@nospam.nospam>
| | | Subject: Get data from Local Web.config not machine.config
| | | Date: Wed, 22 Oct 2008 11:34:06 -0700
| | | Lines: 29
| | | Message-ID: <97**********************************@microsoft.co m>
| | | MIME-Version: 1.0
| | | Content-Type: text/plain;
| | | charset="Utf-8"
| | | Content-Transfer-Encoding: 7bit
| | | X-Newsreader: Microsoft CDO for Windows 2000
| | | Content-Class: urn:content-classes:message
| | | Importance: normal
| | | Priority: normal
| | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| | | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | | Path: TK2MSFTNGHUB02.phx.gbl
| | | Xref: TK2MSFTNGHUB02.phx.gbl
| | microsoft.public.dotnet.framework.aspnet:78389
| | | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| | |
| | | I have a app that uses several membership/role providers. I can
list
| | these
| | | Providers with the code:
| | | Dim rootWebConfig1 As Configuration
| | | rootWebConfig1 =
| | |
WebConfigurationManager.OpenWebConfiguration(Reque st.ApplicationPath)
| | | Dim section As New MembershipSection
| | | section = rootWebConfig1.GetSection("system.web/membership")
| | |
| | |
| | |
| | | Using the Immediate Window :
| | |
| | | ? section.Providers(0).Name
| | | "AspNetSqlMembershipProvider"
| | | ? section.Providers(1).Name
| | | "MemberProv1"
| | | ? section.Providers(2).Name
| | | "ADProvider1"
| | |
| | | As you can see I can list the providers but the Provider
| | | AspNetSqlMembershipProvider" is in the machine.config I do not
have
| | control
| | | over the machine config at all my sites so I want to get the
| Providers
| | only
| | | from the web.config in my application.
| | |
| | | How do I do this.
| | |
| | | Thank you
| | | --
| | | Jerry
| | |
| | >
| | >
| |
| >
| >
|

Oct 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.