Below is the process, how I have implemented the Oracle-ASP.NET-Provider within a ASP.NET web-application.
The first step is to install the latest version of the "Oracle Data Provider for .NET" from the oracle site.
Then the next step is to create all the tables required for the Oracle-ASP.NET-Provider. For this, simply run the sql query from the file "InstallAllOracleASPNETProviders.sql" located at "C:\app\[the_computer_name]\product\11.2.0\client_4\ASP.NET\SQL" (considering you have accepted the default location for the installation).
1. Web.config
The web.config of the web-application looks like
[' < ' and ' > ' replaced by ' ( ' and ' ) ']
Connection String
(membership defaultProvider="OracleMembershipProvider")
(providers)
(clear/)
(add name="OracleMembershipProvider" type="Oracle.Web.Security.OracleMembershipProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
connectionStringName="OraAspNetConnectionString" applicationName="" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true"
passwordFormat="Hashed" maxInvalidPasswordAttempts="10" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /)
(/providers)
(/membership)
Profile Settings
(profile)
(providers)
(clear/)
(add name="OracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
connectionStringName="OraAspNetConnectionString" applicationName="/"/)
(/providers)
(/profile)
Role Settings
(roleManager enabled="true" defaultProvider ="OracleRoleProvider")
(providers)
(clear/)
(add name="OracleRoleProvider" type="Oracle.Web.Security.OracleRoleProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
connectionStringName="OraAspNetConnectionString" applicationName="/" /)
(!--(add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /)--)
(/providers)
(/roleManager)
Here the OracleDataAccess.dll of version 2 is being used.
[' < ' and ' > ' replaced by ' ( ' and ' ) ']
Connection String
(add name="OraAspNetConnectionString" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db_ip)(PORT=db_port))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME = orcl)));User Id=user_db;Password=password_db;pooling=true;min pool size=9" providerName="Oracle.DataAccess.Client"/)Membership Settings
(membership defaultProvider="OracleMembershipProvider")
(providers)
(clear/)
(add name="OracleMembershipProvider" type="Oracle.Web.Security.OracleMembershipProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
connectionStringName="OraAspNetConnectionString" applicationName="" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true"
passwordFormat="Hashed" maxInvalidPasswordAttempts="10" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /)
(/providers)
(/membership)
Profile Settings
(profile)
(providers)
(clear/)
(add name="OracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
connectionStringName="OraAspNetConnectionString" applicationName="/"/)
(/providers)
(/profile)
Role Settings
(roleManager enabled="true" defaultProvider ="OracleRoleProvider")
(providers)
(clear/)
(add name="OracleRoleProvider" type="Oracle.Web.Security.OracleRoleProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
connectionStringName="OraAspNetConnectionString" applicationName="/" /)
(!--(add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /)--)
(/providers)
(/roleManager)
Here the OracleDataAccess.dll of version 2 is being used.
2. Creating User
protected void btnCreateUser_Click(object sender, EventArgs e)
{
try
{
Membership.CreateUser(txtUsername.Text, txtPassword.Text, txtUserEmail.Text);
txtUsername.Text = "User Created Successfully";
}
catch (Exception)
{
throw;
}
}
3. Creating Role
protected void btnCreateRole_Click(object sender, EventArgs e)
{
String roleName = txtRole.Text.Trim();
try
{
if (!Roles.RoleExists(roleName))
{
Roles.CreateRole(roleName);
txtRole.Text = "Role Created Successfully. " + txtRole.Text;
}
else
{
txtRole.Text = "Role already exists. " + txtRole.Text;
}
}
catch (Exception ex)
{
throw;
}
}
4. Assigning Role to User
protected void btnAddRoleToUser_Click(object sender, EventArgs e)
{
try
{
Roles.AddUserToRole(txtUser.Text,txtRoleToAdd.Text);
txtRoleToAdd.Text = "Role added";
}
catch (Exception)
{
throw;
}
}
5. User Login
protected void btnLogin_Click(object sender, EventArgs e)
{
try
{
if (Membership.ValidateUser(txtUserName.Text, txtPassword.Text))
{
FormsAuthentication.SetAuthCookie(txtUserName.Text, true);
txtUserName.Text = "success";
}
else {
txtUserName.Text = "fail";
}
}
catch (Exception)
{
throw;
}
}