Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

can you add AspNetSqlMembershipProvider, AspNetSqlProfileProvider, & AspNetSqlRoleProvider elements at runtime?

$
0
0

I am working on a web based app that I have added an encrypted routine to read and write the connection string using a encrypted file for better security. connection string I pull from the file works fine for all the regular database operations, but I have run into a road block when it comes to membership, Profile, and roles. I have not been able to completely remove the "ApplicationServices" 'ConnectionString' element from the web.config file yet because these three elements in web.config (AspNetSqlMembershipProvider , AspNetSqlProfileProvider, & AspNetSqlRoleProvider) use "ApplicationServices" for the "ConnectionStringName".

Is there a way to set the properties for AspNetSqlMembershipProvider, AspNetSqlProfileProvider, & AspNetSqlRoleProvider from code at start up? I would like to be able to remove these three items from the web.config file and set the element properties from code instead. Below is a snip from a web.config with an example of the lines I would like to remove from web.config and set from code.

<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" applicationName="/" connectionStringName="ApplicationServices" passwordFormat="Encrypted" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="5"/>

<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" applicationName="/" connectionStringName="ApplicationServices"/>

<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" applicationName="/" connectionStringName="ApplicationServices"/>


Viewing all articles
Browse latest Browse all 4737

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>