Ok, I have my web application with this web.config for the manage of users and roles
<connectionStrings>
<add name="MySqlConnection" connectionString="" />
</connectionStrings>
<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MySqlConnection"
applicationName="/"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed" />
</providers>
</membership>
For security reason i can't set the connection string in my web.config. Now i want to know if i can pass in the application the instance of the connection to the forms authentication in some way.
Note’s that i don’t want to set the connection string in runtime I want pass the instance of the connection
Make a class library and a class in it. This class could contain a function as follows:
Now you can reference the above class library in your project.
You could also encrypt your connection string. Refer to these articles: