Get data from Local Web.config not machine.config

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SmVycnkgQw==?=

    #1

    Get data from Local Web.config not machine.config

    I have a app that uses several membership/role providers. I can list these
    Providers with the code:
    Dim rootWebConfig1 As Configuration
    rootWebConfig1 =
    WebConfiguratio nManager.OpenWe bConfiguration( Request.Applica tionPath)
    Dim section As New MembershipSecti on
    section = rootWebConfig1. GetSection("sys tem.web/membership")



    Using the Immediate Window :

    ? section.Provide rs(0).Name
    "AspNetSqlMembe rshipProvider"
    ? section.Provide rs(1).Name
    "MemberProv 1"
    ? section.Provide rs(2).Name
    "ADProvider 1"

    As you can see I can list the providers but the Provider
    AspNetSqlMember shipProvider" 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
  • Allen Chen [MSFT]

    #2
    RE: Get data from Local Web.config not machine.config

    Hi Jerry,

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


    x?dg=microsoft. public.dotnet.f ramework.aspnet &tid=0e140c7 e-d85d-47bc-bcba-52
    35731b9edb&cat= en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&la ng=en&cr=us&slo c
    =&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:
    msdnmg@microsof t.com.

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

    us/subscriptions/aa948868.aspx#n otifications.

    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: Ack0dMPG5k4uZE2 9T5SP1nO/sd0qAQ==
    | X-WBNR-Posting-Host: 65.55.21.8
    | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@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: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
    | 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.publi c.dotnet.framew ork.aspnet
    | Path: TK2MSFTNGHUB02. phx.gbl
    | Xref: TK2MSFTNGHUB02. phx.gbl
    microsoft.publi c.dotnet.framew ork.aspnet:7838 9
    | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
    | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
    |
    | I have a app that uses several membership/role providers. I can list
    these
    | Providers with the code:
    | Dim rootWebConfig1 As Configuration
    | rootWebConfig1 =
    | WebConfiguratio nManager.OpenWe bConfiguration( Request.Applica tionPath)
    | Dim section As New MembershipSecti on
    | section = rootWebConfig1. GetSection("sys tem.web/membership")
    |
    |
    |
    | Using the Immediate Window :
    |
    | ? section.Provide rs(0).Name
    | "AspNetSqlMembe rshipProvider"
    | ? section.Provide rs(1).Name
    | "MemberProv 1"
    | ? section.Provide rs(2).Name
    | "ADProvider 1"
    |
    | As you can see I can list the providers but the Provider
    | AspNetSqlMember shipProvider" 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
    |

    Comment

    • =?Utf-8?B?SmVycnkgQw==?=

      #3
      RE: Get data from Local Web.config not machine.config

      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:
      >

      x?dg=microsoft. public.dotnet.f ramework.aspnet &tid=0e140c7 e-d85d-47bc-bcba-52
      35731b9edb&cat= en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&la ng=en&cr=us&slo c
      =&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:
      msdnmg@microsof t.com.
      >
      =============== =============== =============== =====
      Get notification to my posts through email? Please refer to
      http://msdn.microsoft.com/en-
      >
      us/subscriptions/aa948868.aspx#n otifications.
      >
      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: Ack0dMPG5k4uZE2 9T5SP1nO/sd0qAQ==
      | X-WBNR-Posting-Host: 65.55.21.8
      | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@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: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
      | 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.publi c.dotnet.framew ork.aspnet
      | Path: TK2MSFTNGHUB02. phx.gbl
      | Xref: TK2MSFTNGHUB02. phx.gbl
      microsoft.publi c.dotnet.framew ork.aspnet:7838 9
      | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
      | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
      |
      | I have a app that uses several membership/role providers. I can list
      these
      | Providers with the code:
      | Dim rootWebConfig1 As Configuration
      | rootWebConfig1 =
      | WebConfiguratio nManager.OpenWe bConfiguration( Request.Applica tionPath)
      | Dim section As New MembershipSecti on
      | section = rootWebConfig1. GetSection("sys tem.web/membership")
      |
      |
      |
      | Using the Immediate Window :
      |
      | ? section.Provide rs(0).Name
      | "AspNetSqlMembe rshipProvider"
      | ? section.Provide rs(1).Name
      | "MemberProv 1"
      | ? section.Provide rs(2).Name
      | "ADProvider 1"
      |
      | As you can see I can list the providers but the Provider
      | AspNetSqlMember shipProvider" 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
      |
      >
      >

      Comment

      • Allen Chen [MSFT]

        #4
        RE: Get data from Local Web.config not machine.config

        Hi Jerry,

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



        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+36aDtinr eT0GwbKzBZF9JKw ==
        | X-WBNR-Posting-Host: 207.46.192.207
        | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@nospam .nospam>
        | References: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
        <EQciCmLNJHA.16 56@TK2MSFTNGHUB 02.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: <1F6C86E9-D59C-44D9-A80A-9683CD14E2AC@mi crosoft.com>
        | 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.publi c.dotnet.framew ork.aspnet
        | Path: TK2MSFTNGHUB02. phx.gbl
        | Xref: TK2MSFTNGHUB02. phx.gbl
        microsoft.publi c.dotnet.framew ork.aspnet:7847 1
        | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
        | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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:
        | >
        | >

        | >
        x?dg=microsoft. public.dotnet.f ramework.aspnet &tid=0e140c7 e-d85d-47bc-bcba-52
        | >
        35731b9edb&cat= en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&la ng=en&cr=us&slo c
        | =&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:
        | msdnmg@microsof t.com.
        | >
        | =============== =============== =============== =====
        | Get notification to my posts through email? Please refer to
        | http://msdn.microsoft.com/en-
        | >
        | us/subscriptions/aa948868.aspx#n otifications.
        | >
        | 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: Ack0dMPG5k4uZE2 9T5SP1nO/sd0qAQ==
        | | X-WBNR-Posting-Host: 65.55.21.8
        | | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@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: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
        | | 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.publi c.dotnet.framew ork.aspnet
        | | Path: TK2MSFTNGHUB02. phx.gbl
        | | Xref: TK2MSFTNGHUB02. phx.gbl
        | microsoft.publi c.dotnet.framew ork.aspnet:7838 9
        | | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
        | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
        | |
        | | I have a app that uses several membership/role providers. I can list
        | these
        | | Providers with the code:
        | | Dim rootWebConfig1 As Configuration
        | | rootWebConfig1 =
        | | WebConfiguratio nManager.OpenWe bConfiguration( Request.Applica tionPath)
        | | Dim section As New MembershipSecti on
        | | section = rootWebConfig1. GetSection("sys tem.web/membership")
        | |
        | |
        | |
        | | Using the Immediate Window :
        | |
        | | ? section.Provide rs(0).Name
        | | "AspNetSqlMembe rshipProvider"
        | | ? section.Provide rs(1).Name
        | | "MemberProv 1"
        | | ? section.Provide rs(2).Name
        | | "ADProvider 1"
        | |
        | | As you can see I can list the providers but the Provider
        | | AspNetSqlMember shipProvider" 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
        | |
        | >
        | >
        |

        Comment

        • =?Utf-8?B?SmVycnkgQw==?=

          #5
          RE: Get data from Local Web.config not machine.config

          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="MemberPro v1" applicationName ="/myapp"
          connectionStrin gName="MemConne ction1" requiresQuestio nAndAnswer="fal se"
          minRequiredPass wordLength="3" requiresUniqueE mail="false"
          minRequiredNona lphanumericChar acters="0" passwordStrengt hRegularExpress ion=""
          type="System.We b.Security.SqlM embershipProvid er, System.Web, Version=2.0.0.0 ,
          Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a"/>
          <add name="ADProvide r1"
          attributeMapUse rname="sAMAccou ntName"
          connectionStrin gName="ADConnec tionString1" connectionUsern ame="rpaul"
          connectionPassw ord="ajdoivmejr " enableSearchMet hods="true"
          type="System.We b.Security.Acti veDirectoryMemb ershipProvider, System.Web,
          Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a"/>
          </providers>
          </membership>


          Then when I use:
          Dim MemSection As New MembershipSecti on
          Dim RoleSection As New RoleManagerSect ion
          MemSection = rootWebConfig1. GetSection("sys tem.web/membership")
          RoleSection = rootWebConfig1. GetSection("sys tem.web/roleManager")

          RoleSection.Pro viders(0).Name or
          Membership.Prov iders(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
          AspNetSqlMember shipProvider in an easier way. You're welcome to submit a
          feedback here:
          >

          >
          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+36aDtinr eT0GwbKzBZF9JKw ==
          | X-WBNR-Posting-Host: 207.46.192.207
          | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@nospam .nospam>
          | References: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
          <EQciCmLNJHA.16 56@TK2MSFTNGHUB 02.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: <1F6C86E9-D59C-44D9-A80A-9683CD14E2AC@mi crosoft.com>
          | 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.publi c.dotnet.framew ork.aspnet
          | Path: TK2MSFTNGHUB02. phx.gbl
          | Xref: TK2MSFTNGHUB02. phx.gbl
          microsoft.publi c.dotnet.framew ork.aspnet:7847 1
          | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
          | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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:
          | >
          | >

          | >
          x?dg=microsoft. public.dotnet.f ramework.aspnet &tid=0e140c7 e-d85d-47bc-bcba-52
          | >
          35731b9edb&cat= en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&la ng=en&cr=us&slo c
          | =&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:
          | msdnmg@microsof t.com.
          | >
          | =============== =============== =============== =====
          | Get notification to my posts through email? Please refer to
          | http://msdn.microsoft.com/en-
          | >
          | us/subscriptions/aa948868.aspx#n otifications.
          | >
          | 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: Ack0dMPG5k4uZE2 9T5SP1nO/sd0qAQ==
          | | X-WBNR-Posting-Host: 65.55.21.8
          | | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@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: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
          | | 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.publi c.dotnet.framew ork.aspnet
          | | Path: TK2MSFTNGHUB02. phx.gbl
          | | Xref: TK2MSFTNGHUB02. phx.gbl
          | microsoft.publi c.dotnet.framew ork.aspnet:7838 9
          | | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
          | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
          | |
          | | I have a app that uses several membership/role providers. I can list
          | these
          | | Providers with the code:
          | | Dim rootWebConfig1 As Configuration
          | | rootWebConfig1 =
          | | WebConfiguratio nManager.OpenWe bConfiguration( Request.Applica tionPath)
          | | Dim section As New MembershipSecti on
          | | section = rootWebConfig1. GetSection("sys tem.web/membership")
          | |
          | |
          | |
          | | Using the Immediate Window :
          | |
          | | ? section.Provide rs(0).Name
          | | "AspNetSqlMembe rshipProvider"
          | | ? section.Provide rs(1).Name
          | | "MemberProv 1"
          | | ? section.Provide rs(2).Name
          | | "ADProvider 1"
          | |
          | | As you can see I can list the providers but the Provider
          | | AspNetSqlMember shipProvider" 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
          | |
          | >
          | >
          |
          >
          >

          Comment

          • Allen Chen [MSFT]

            #6
            RE: Get data from Local Web.config not machine.config

            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= =?= <jerryed@nospam .nospam>
            | References: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
            <EQciCmLNJHA.16 56@TK2MSFTNGHUB 02.phx.gbl>
            <1F6C86E9-D59C-44D9-A80A-9683CD14E2AC@mi crosoft.com>
            <a6MILDYNJHA.41 12@TK2MSFTNGHUB 02.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: <3395AEAB-4A2D-4A1E-9A8B-967DF19EE188@mi crosoft.com>
            | 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.publi c.dotnet.framew ork.aspnet
            | Path: TK2MSFTNGHUB02. phx.gbl
            | Xref: TK2MSFTNGHUB02. phx.gbl
            microsoft.publi c.dotnet.framew ork.aspnet:7856 8
            | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
            | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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="MemberPro v1" applicationName ="/myapp"
            | connectionStrin gName="MemConne ction1" requiresQuestio nAndAnswer="fal se"
            | minRequiredPass wordLength="3" requiresUniqueE mail="false"
            | minRequiredNona lphanumericChar acters="0"
            passwordStrengt hRegularExpress ion=""
            | type="System.We b.Security.SqlM embershipProvid er, System.Web,
            Version=2.0.0.0 ,
            | Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a"/>
            | <add name="ADProvide r1"
            | attributeMapUse rname="sAMAccou ntName"
            | connectionStrin gName="ADConnec tionString1" connectionUsern ame="rpaul"
            | connectionPassw ord="ajdoivmejr " enableSearchMet hods="true"
            | type="System.We b.Security.Acti veDirectoryMemb ershipProvider, System.Web,
            | Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a"/>
            | </providers>
            | </membership>
            |
            |
            | Then when I use:
            | Dim MemSection As New MembershipSecti on
            | Dim RoleSection As New RoleManagerSect ion
            | MemSection = rootWebConfig1. GetSection("sys tem.web/membership")
            | RoleSection = rootWebConfig1. GetSection("sys tem.web/roleManager")
            |
            | RoleSection.Pro viders(0).Name or
            | Membership.Prov iders(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
            | AspNetSqlMember shipProvider 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+36aDtinr eT0GwbKzBZF9JKw ==
            | | X-WBNR-Posting-Host: 207.46.192.207
            | | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@nospam .nospam>
            | | References: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
            | <EQciCmLNJHA.16 56@TK2MSFTNGHUB 02.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: <1F6C86E9-D59C-44D9-A80A-9683CD14E2AC@mi crosoft.com>
            | | 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.publi c.dotnet.framew ork.aspnet
            | | Path: TK2MSFTNGHUB02. phx.gbl
            | | Xref: TK2MSFTNGHUB02. phx.gbl
            | microsoft.publi c.dotnet.framew ork.aspnet:7847 1
            | | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
            | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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:
            | | >
            | | >
            | >

            | | >
            | >
            x?dg=microsoft. public.dotnet.f ramework.aspnet &tid=0e140c7 e-d85d-47bc-bcba-52
            | | >
            | >
            35731b9edb&cat= en_us_10ca9291-071d-4a5d-ba07-3a2422fddf6a&la ng=en&cr=us&slo c
            | | =&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:
            | | msdnmg@microsof t.com.
            | | >
            | | =============== =============== =============== =====
            | | Get notification to my posts through email? Please refer to
            | | http://msdn.microsoft.com/en-
            | | >
            | | us/subscriptions/aa948868.aspx#n otifications.
            | | >
            | | 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: Ack0dMPG5k4uZE2 9T5SP1nO/sd0qAQ==
            | | | X-WBNR-Posting-Host: 65.55.21.8
            | | | From: =?Utf-8?B?SmVycnkgQw= =?= <jerryed@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: <97962A86-0671-408D-B114-1C2B2A9FC997@mi crosoft.com>
            | | | 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.publi c.dotnet.framew ork.aspnet
            | | | Path: TK2MSFTNGHUB02. phx.gbl
            | | | Xref: TK2MSFTNGHUB02. phx.gbl
            | | microsoft.publi c.dotnet.framew ork.aspnet:7838 9
            | | | NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
            | | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
            | | |
            | | | I have a app that uses several membership/role providers. I can
            list
            | | these
            | | | Providers with the code:
            | | | Dim rootWebConfig1 As Configuration
            | | | rootWebConfig1 =
            | | |
            WebConfiguratio nManager.OpenWe bConfiguration( Request.Applica tionPath)
            | | | Dim section As New MembershipSecti on
            | | | section = rootWebConfig1. GetSection("sys tem.web/membership")
            | | |
            | | |
            | | |
            | | | Using the Immediate Window :
            | | |
            | | | ? section.Provide rs(0).Name
            | | | "AspNetSqlMembe rshipProvider"
            | | | ? section.Provide rs(1).Name
            | | | "MemberProv 1"
            | | | ? section.Provide rs(2).Name
            | | | "ADProvider 1"
            | | |
            | | | As you can see I can list the providers but the Provider
            | | | AspNetSqlMember shipProvider" 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
            | | |
            | | >
            | | >
            | |
            | >
            | >
            |

            Comment

            Working...