Tutorial: Integrate Tide in a Csharp WebForm Application
Run a WebForms app with a companion ASP.NET Core auth sub‑application that handles TideCloak logins. WebForms reads cookies set by the Core app.
1) Create projects
- WebFormsApp (UI)
- CoreApp (Razor Pages) - performs OIDC login/logout and writes cookies (
UserName,Subject).
2) WebForms default page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"Inherits="WebForms._Default" Async="true" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title>Welcome</title></head><body><form id="form1" runat="server"><div><a href="/coreapp/login">Login to Core App</a><br/><a href="/coreapp/logout">Logout from Core App</a><br/><asp:Panel ID="UserInfoPanel" runat="server" Visible="false"><asp:Literal ID="UserInfo" runat="server" /></asp:Panel></div></form></body></html>
**
protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) {var u = Request.Cookies["UserName"]?.Value;var s = Request.Cookies["Subject"]?.Value;if (!string.IsNullOrEmpty(u) && !string.IsNullOrEmpty(s)) {UserInfo.Text = $"Welcome, {u}! Your Session ID is {s}.";UserInfoPanel.Visible = true;}}}
3) CoreApp authentication
Install OIDC/Cookies packages and configure Program.cs as in the ASP.NET Core tutorial (authority, client, scopes, etc.).
Login/Logout/Callback
Use the Pages you provided (Login.cshtml(.cs), Logout.cshtml(.cs), Callback.cshtml(.cs)) and in Callback set cookies then redirect back to WebForms:
Response.Cookies.Append("UserName", userName,new CookieOptions {Expires = DateTimeOffset.Now.AddMinutes(30)});Response.Cookies.Append("Subject", subject,new CookieOptions {Expires = DateTimeOffset.Now.AddMinutes(30)});return Redirect("http://localhost:8000/Default.aspx");
4) Configure IIS Express (sub‑application)
Edit applicationhost.config so CoreApp is a sub‑app under WebFormsApp:
<application path="/coreapp" applicationPool="TideAuthAppPool"><virtualDirectory path="/" physicalPath="C:\Path\CoreApp\bin\Release\net8.0\publish" /></application>
Publish CoreApp (dotnet publish -c Release) to the folder referenced above.
5) Run
Start WebFormsApp (IIS Express). Visit http://localhost:8000, click Login to Core App, authenticate, and verify the user details show from cookies.