Thank you for reaching out to Microsoft Q & A forum.
Since Forms Authentication in cookieless mode (UseUri) stores the authentication ticket in the URL, users can still access the sub-application if they reuse an old URL. To properly enforce logout across both applications, consider the following solutions:
1.Sign Out and Redirect: Ensure FormsAuthentication.SignOut() is followed by a redirect to prevent ticket reuse:
FormsAuthentication.SignOut();
Response.Redirect("~/Login.aspx");
2.Expire the Authentication Ticket: Manually invalidate the ticket to ensure it cannot be reused:
FormsAuthenticationTicket expiredTicket = new FormsAuthenticationTicket(1, "", DateTime.Now, DateTime.Now.AddSeconds(-1), false, "");
string encryptedTicket = FormsAuthentication.Encrypt(expiredTicket);
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket));
3.Centralized Logout from the Main Application:
The Python app should call https://subapp.example.com/logout.aspx when logging out.
The sub-application should:
Call FormsAuthentication.SignOut().
Redirect to the login page.
Clear session data (Session.Abandon()).
4.Validate Sessions Server-Side:
Store session states in a database or Redis.
Before granting access, check if the session is still valid.
5.Prevent URL-Based Authentication Ticket Reuse:
Use short-lived authentication tickets.
Implement URL rewriting to remove the authentication ticket after login.
Please feel free to contact us if you have any additional questions.
If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.