This sample demonstrates using ASP.NET Session, HttpContext cookies and Forms Authentication with DotVVM.
This sample is applicable only for the OWIN version of DotVVM. We do not recommend using any of these features in new apps. This scenario is useful especially when you try to modernize old ASP.NET Web Forms applications using DotVVM or use DotVVM in a Web Forms app.
- Make sure you have installed DotVVM for Visual Studio
-
Open the GitHub repo in Visual Studio or
git clone https://github.com/riganti/dotvvm-samples-session.git -
Open
src/DotvvmSessionSample.sln -
Right-click the
DotvvmSessionSampleproject and select View > View in Browser
- How to use Session State behavior and a custom CookieManager in order to make old ASP.NET features like session and Forms Authentication to work with cookies correctly
The sample shows the necessary configuration in Startup.cs (enabling session state behavior and registering a custom cookie manager that tells DotVVM to write the cookies to the HttpContext cookie container instead of using the OWIN cookie container).
There is also a sample page that uses Forms Authentication - it has to be enabled in web.config using <authentication mode="Forms" />.