Products
Clients
Extensions
APIs
This is VMware GemFire sample code that stores a session state for an ASP.NET app (basically .NET Web App). It's a simple command line program that connects to a region using a cache factory object and does not involve any dependency on Java.
This is a sample code that stores a session state for an ASP.NET app (basically .NET Web App). It’s a command line simple program that connects to a region using cache factory object and does not involve any dependency on Java.
Before you continue, you need to follow these steps for SessionStateProvider sample works:
SessionStateProvider
<!--GemFire SessionStateProvider--> <sessionState mode="Custom" cookieless="false" timeout="20" customProvider="GemFireSessionProvider"> <providers> <add name="GemFireSessionProvider" type="Pivotal.GemFire.Session.SessionStateStore" region="sessionStateRegion"/> </providers> </sessionState>
Global.asax.cs
BasicAuthInitialize
Apache.Geode.Client.IAuthInitialize
BasicAuthInitialize.cs
public class BasicAuthInitialize : IAuthInitialize { private string _username; private string _password; public BasicAuthInitialize(string username, string password) { _username = username; _password = password; } public void Close() { } public Properties<string, object> GetCredentials(Properties<string, string> props, string server) { var credentials = new Properties<string, object>(); credentials.Insert("security-username", _username); credentials.Insert("security-password", _password); return credentials; } }
Please refer to the .NET Framework Native Client docs for more details.
Application_Start()
BasicAuthInitializeClass
geode.properties
cache.xml
This sample was created, built and tested with Microsoft Visual Studio 2017 Community Edition.