Adding Oracle Role Provider to ASP.NET
Installating Oracle Role Provider in ASP.NET
Installing Oracle 11g
First of all before you can use the profile provider capabilities in ASP.NET, you must install Oracle 11g and run the installation scripts. The download for 11g can be found here: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Oracle have instructions on their website on how to install and set this up:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10767/installation.htm
Configuring Oracle Role Provider in Web.config
To add the Oracle Role Provider to ASP.NET, you must declare the provider and the profile elements in the system.web section of your web config file. Configure the connection string and application name properties for your application.
'Add to web.config
<profile defaultprovider="myOracleProfileProvider" enabled="true"><providers">
<add applicationname="MyApplication" connectionstringname="myConnectionString" name="myOracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342">
</providers>
<properties>
<add name="Employee_Name" type="System.String">
</properties>
</profile>
In the <properties> section, you declare the elements of your profile. In this case I am just adding one string property - Customer_ID.
Using Oracle Profile Provider in ASP.NET
Accessing Profile Properties in ASP.NET
You can now use ProfileCommon (Profile) to retrieve and set your property values in ASP.NET
'Retrieve the profile for the current user
Dim customerID As StringcustomerID = Profile.Employee_Name.ToString
You can also set the property value.
Profile.Employee_Name = customerID
Profile V Session
You can use the profile provider as an alternative to session variables where you wish to store information about your user. The difference between these is that profile information is persistent between sessions, whereas session data is lost upon timeout. This may be useful where you are concerned that ticket and session timeouts may be out of snych and have concerns about losing identifying information about your user.
No comments:
Post a Comment