Currently I have an application that has the following mix:
ASP.net
C#
MySql for data storage.
SqlServer Express for session management.
I was looking for a way to only keep MySql and drop the instance of SqlServer Express, that's when I found an article where they explain how to create a custom provider to store the session information:
http://msdn.microsoft.com/en-us/library/ms178589.aspx
I copied and pasted the code and but didn't work quite well.
I fixed the sql, since the provided seems to be written for other db engine.
CREATE TABLE `sessionmanager`.`Sessions` (
`SessionId` varchar(80) NOT NULL,
`ApplicationName` varchar(255) NOT NULL,
`Created` datetime DEFAULT NULL,
`Expires` datetime NOT NULL,
`LockDate` datetime NOT NULL,
`LockId` int(11) NOT NULL,
`Timeout` int(11) NOT NULL,
`Locked` tinyint(1) NOT NULL,
`SessionItems` text,
`Flags` int(11) NOT NULL,
PRIMARY KEY (`SessionId`,`ApplicationName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
I decided as well to use directly the MySql Connector instead of the Odbc stuff in order to gain some speed.
To use the code just download the project, add it as a reference to your project and that's it.
Inside the web.config you will need to add the following entries:
To download the source project clic here!
Thursday, November 12, 2009
Subscribe to:
Posts (Atom)