Session state SQLServer mode using Oracle database - asp.net

Is it possible to use Oracle database? Web app is currently using Oracle and may not have access to SQL Server.
Thanks.
RO

Yes it is possible in fact Oracle provides library of asp.net providers including :
Membership Provider
Role Provider
Site Map Provider
Session State Provider
Profile Provider
Web Events Provider
Web Parts Personalization Provider
Cache Dependency Provider
You can find them here.
http://www.oracle.com/technetwork/topics/dotnet/index-087367.html

Out-of-the-box that's not possible. ASP.NET supports the following session state providers:
In-Process - the session is stored into the memory of the web server
State Server - the session is serialized and stored into the memory of a specific server running the ASP.NET session state service. This could be a different machine from the web server
SQL Server - the session is serialized and persisted into a MS SQL Server database
The SQLServer sessionState mode uses, as it's names suggests, SQL Server. If you want to use Oracle you will have to write a custom session state provider by inheriting from the SessionStateStoreProviderBase class and overriding all the methods.

Related

Where are sessions stored in ASP.net MVC 5 applications?

I'm working on an ASP.net 4 web application using MVC5. I'm curious as to where sessions are stored in the default application scaffold running locally and whether there's any configuration available.
The session is configured on web.config. By default is saved on memory and a service that runs on server is handle that. Other way is to save it on a database...
This is the Session-State Modes... from MSDN:
InProc mode, which stores session state in memory on the Web server. This is the default.
StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
Custom mode, which enables you to specify a custom storage provider.
Off mode, which disables session state.

.NET Implementing InProc & Sql State Server Hybrid Session Provider

In my .NET application i kinda need a session provider which is persistent like Sql Server Session Provider but also provides good performance like InProc Session Provider.
So the idea that i come up with is , to keep session data in memory cache of the application but also use a background thread to store/update it at sql server database. In case, IIS application recycles or somehow the data in memory cache is lost, we will fetch session data from database into memory cache again.
I need to implement a custom session provider which works the way i explained above.However i dont know, if it is good idea or a bad one. I have searched online but there are not many custom session providers.
Any suggestions?
As a future reference, i think what you were asking is basically use the Session State with Sql Server In-Memory. Have a look to the following guide: ASP.NET Session State Provider for SQL Server In-Memory OLTP.
Cheers

how can two applications use single ASPState database

how can two or more applications use single ASPState database.
I had implemented SQL server session management. I have some asp.net applications deployed on my IIS where i want to implement SQL server session management, so i have ASPState DB, i want to share this DB for all applications.
DB- data base
If you're using the default ASPState database created by the supplied SQL scripts that come with .NET, the database is already designed for shared usage. Just configure each application to point to the same database. The session state is isolated in the db by using the application ID from IIS (i.e. /W3SVC/2165464565), so there's no collision of data.

Connect to SQL Server with EF using windows credentials of final user

I have an application developed in ASP.NET MVC using Entity Framework / Sql Server 2008
Actually, connections to the database are made with the "sa" account.
Is it possible to use, instead of "sa" the windows final user credentials ?
This would be helpful to control more efficiently the security limitations of each user.
I use, in my application windows authentication.
Thank's !
It is possible but whole your system must run inside windows domain, users must have domain accounts and your system infrastructure must be enabled for Kerberos delegation (belongs to ServerFault). The reason is that you have two hoops in the system - first user authenticates from his client machine to your web server and then web server delegates user credentials to database server. If client computer, web server and database server are different machine Kerberos delegation must be enabled (if db and web runs on the same server you should be fine without Kerberos). Your web application will have to use impersonation and your connection string will have to use windows integrated security.
Also using end user credentials will reduce performance of your system because EF will have to maintain separate connection pool per user. Administrator of SQL server will have to give access for every single user (or user group) using your application.

IIS7: Sharing Sessions Between Applications With State Server

I have my default website in IIS7 bound to an ASP.NET application. This application is using the ASP.NET State Server to store session data. I would like to add an additional ASP.NET MVC application to this website. Is it possible to share the session between these two applications using the state server? I've read that there are ways to do it storing session data in SQL Server, but I can't find any documentation on doing it with the state server.
Thanks,
Nathan
Best advice I have to to switch to SQL Server for the session state store. It's not difficult to set up if you already have SQL Available and use the following technique:
Sharing sessions across applications using the ASP.NET Session State Service
For this situation you are probably best to write your own custom session state provider that runs on a SQL database.
details are here:
http://msdn.microsoft.com/en-us/library/aa479034.aspx
the reason i'd write a custom provider is because simply settings up an SQL session provider will not be enough as the applications will use different session keys and therefore will not share state between them. by writing your own session provider you can have fine grained control over the whole process and therefore override the checks in place using the default sql session provider.

Resources