I'm trying to implement a Session-State Provider using this sample from Microsoft:
http://msdn.microsoft.com/en-us/library/ms178589.aspx
But I can't compile it, because .NET throws this errors:
Error 1
'Project.Session.OdbcSessionStateStore' does not implement inherited abstract member 'System.Web.SessionState.SessionStateStoreProviderBase.CreateNewStoreData(System.Web.HttpContext, int)'
Error 2 'Project.Session.OdbcSessionStateStore.CreateNewStoreData(System.Web.HttpContext, double)' is a new virtual member in sealed class 'Project.Session.OdbcSessionStateStore'
Error 3 'Project.Session.OdbcSessionStateStore.CreateNewStoreData(System.Web.HttpContext, double)': no suitable method found to override
Exact piece of code with CreateNewStoreData override:
//
// SessionStateProviderBase.CreateNewStoreData
//
public override SessionStateStoreData CreateNewStoreData(
HttpContext context,
double timeout)
{
return new SessionStateStoreData(new SessionStateItemCollection(),
SessionStateUtility.GetSessionStaticObjects(context),
(int)timeout);
}
From your MSDN link, class OdbcSessionStateStore
is inheriting from SessionStateStoreProviderBase
abstract class. Click Here for more info
As you will have to override all abstract methods from an abstract class (except if the class that you create is also an abstract class), in this example you will need to override the abstract method CreateNewStoreData
. Click Here for more info
When overriding the method signatures should match. In the sample code from your MSDN link the signature is
public override SessionStateStoreData CreateNewStoreData(
HttpContext context,
double timeout)
where as in the actual case it should have been
public override SessionStateStoreData CreateNewStoreData(
HttpContext context,
int timeout
)
Note the difference double timeout
instead of int timeout