How to use Oracle's Session State Provider

I'm trying to get the Oracle Session State provider to work with an existing project.  It looks like it should be simple, just install the client and add a few lines to your web.config file.  Unfortunately, it doesn't seem to be working for me.

When I try to access the website, I get a ConfigurationErrorsException, saying that it couldn't initialize the oracle connection object.  As far as I know the syntax is correct, and the value is too, so I'm not sure what I'm doing wrong.

Attached is the important bits of the web.config file.
<connectionStrings>
    <add name="SessionConnection"
         connectionString="Provider=OraOLEDB.Oracle;Data Source=DNTEST1;User Id=x;Password=y;Database=VITAL_STATISTICS"/>
  </connectionStrings>
 
    <sessionState mode="Custom" customProvider="MyOracleSessionStateStore">
	<providers>
            <add name="MyOracleSessionStateStore"
                connectionStringName="SessionConnection"
                type="Oracle.Web.SessionState.OracleSessionStateStore, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
            />
	</providers>
</sessionState>

Open in new window

Sam_CharetteAsked:
Who is Participating?
 
Computer101Connect With a Mentor Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0
 
Bob LearnedCommented:
Did you find a solution?

Bob
0
 
Sam_CharetteAuthor Commented:
Nope.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Bob LearnedCommented:
Do you have the Oracle .NET Data Provider (ODP.NET) installed?

Bob
0
 
Sam_CharetteAuthor Commented:
Yes, I do.
0
 
Bob LearnedCommented:
I don't remember having to put the provider in the connection string:

    Provider=OraOLEDB.Oracle;

With the SQL Server provider, you can't put the provider in the string, since it is known by the SqlClient provider.

Bob
0
 
Sam_CharetteAuthor Commented:
Unfortunately this didn't seem to help either. :-/
0
 
Bob LearnedCommented:
I would test that by tryimg to use that connection string to create an OleConnection instance, and then try to open the connection.

Bob
0
 
Sam_CharetteAuthor Commented:
The exact same connection string is used elsewhere to create an OleConnection instance already.
0
 
Bob LearnedCommented:
Does your Oracle database instance have the necessary schema to handle session state?

Bob
0
 
Sam_CharetteAuthor Commented:
Yup.  As this is only a test, I added it to the schema of the application database.
0
 
Bob LearnedCommented:
Hmmm...I am at a loss, and it has been too long to remember the steps (I am using SQL Server now).  I would reask this question, if you didn't get an answer.

Bob
0
 
Sam_CharetteAuthor Commented:
Well thanks for trying :)
0
 
Sam_CharetteAuthor Commented:
We finally got it to work.  The problem was the connection string, and it looks nothing like I've ever seen before.  It actually should be this:

<connectionStrings>
<add name="SessionConnection" connectionString="Data
Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ORADEV1)(PORT=
1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DNTEST1)));User
Id=xxx;Password=yyy;"/>
</connectionStrings>

We found this at http://www.connectionstrings.com/?carrier=oracle .  You can find the connection string for your server by running "tnsping <server>" from the command line.
0
All Courses

From novice to tech pro — start learning today.