Anubis2005
asked on
Custom role provider access to web.config settings
Hello All,
I'm in the process of creating a custom role/membership provider but I'm needing to know how I can access the settings of the provider as defined in the web.config file.
Example web.config:
<configuration>
<connectionStrings>
<add name="myConnectionString"
connectionString="Data Source={DBSERVER};Initial Catalog={DBNAME};Persist Security Info=True;User ID={USERNAME};Password={PA SS}"
providerName="System.Data. SqlClient" />
</connectionStrings>
<system.web>
<membership defaultProvider="{NAME}Mem bershipPro vider">
<providers>
<clear/>
<add name="{NAME}MembershipProv ider"
type="AS.Security.Provider s.Membersh ip"
connectionStringName="myCo nnectionSt ring"
enablePasswordRetrieval="f alse"
enablePasswordReset="true"
requiresQuestionAndAnswer= "true"
applicationName="{APPLICAT ION_NAME}"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts ="5"
minRequiredPasswordLength= "7"
minRequiredNonalphanumeric Characters ="1"
passwordAttemptWindow="10"
passwordStrengthRegularExp ression="" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="{NAME}Rol eProvider" >
<providers>
<clear/>
<add name="{NAME}RoleProvider"
type="AS.Security.Provider s.Role"
applicationName="{APPLICAT ION_NAME}"
connectionStringName="myCo nnectionSt ring" />
</providers>
</roleManager>
<authentication mode="Forms">
<forms slidingExpiration="true" timeout="60" />
</authentication>
</system.web>
</configuration>
What I want to know, from within my custom provider, how can I find out what the connection string is that is defined in the web.config from within my custom class?
Thanks
Anubis.
I'm in the process of creating a custom role/membership provider but I'm needing to know how I can access the settings of the provider as defined in the web.config file.
Example web.config:
<configuration>
<connectionStrings>
<add name="myConnectionString"
connectionString="Data Source={DBSERVER};Initial Catalog={DBNAME};Persist Security Info=True;User ID={USERNAME};Password={PA
providerName="System.Data.
</connectionStrings>
<system.web>
<membership defaultProvider="{NAME}Mem
<providers>
<clear/>
<add name="{NAME}MembershipProv
type="AS.Security.Provider
connectionStringName="myCo
enablePasswordRetrieval="f
enablePasswordReset="true"
requiresQuestionAndAnswer=
applicationName="{APPLICAT
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts
minRequiredPasswordLength=
minRequiredNonalphanumeric
passwordAttemptWindow="10"
passwordStrengthRegularExp
</providers>
</membership>
<roleManager enabled="true" defaultProvider="{NAME}Rol
<providers>
<clear/>
<add name="{NAME}RoleProvider"
type="AS.Security.Provider
applicationName="{APPLICAT
connectionStringName="myCo
</providers>
</roleManager>
<authentication mode="Forms">
<forms slidingExpiration="true" timeout="60" />
</authentication>
</system.web>
</configuration>
What I want to know, from within my custom provider, how can I find out what the connection string is that is defined in the web.config from within my custom class?
Thanks
Anubis.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.