For some reason, in our application, it will encounter a user who can log in in one place, that is, the single sign-on of us usually said. Implementing a single sign in ASP.NET is actually simple, and the main methods and all code are analyzed below.
Implementation
With the function of cache, we save the user's login information in cache and set the time for the expiration time for the session failure. Therefore, once the session invalid, our Cache has expired; and Cache can access all users, so It is convenient to use it to save user information than the database.
View example
SINGLOGIN.ASPX code
<% @ Page language = "c #" codebehind = "singlelogin.aspx.cs" autoeventwireup = "false" inherits = "EMENG.EXAM.SINGLOGIN"%>