ASP. NET specifies that one or more session values are shared with other sites.

Source: Internet
Author: User

This idea is a problem in the recent project. All that comes to mind is a single sign-on (Single Sign-On), that is, shared login information. Previously, all sessions are shared with other sites on the Internet, in this way, there will be a lot of confusion. How can we share only one session? For example, I shared the value of session ["logininfo, or can I only get the value of the session ["logininfo"] of my website on other sites? First, let's take a look at the implementation method of sharing all sessions. Sharing all sessions must achieve the following effects:

1. Ensure that the sessionid values of all sites are the same, no matter which site you first enter
2. Modify the difference string of the site
There are many ways to implement the above functions. The most reasonable one is to customize the management class of sessionid, that is, Inherit System. web. sessionstate. A class of the isessionidmanager interface, so that we can easily make all the site sessionid values completely consistent by managing the sessionid,

It will be a little complicated to implement the sharing of specified sessions. First, let's look at the session storage mechanism. There are three session storage methods. Which of the three methods are quite clear to everyone, decompilation, view the source code, and find that the three storage mechanisms all inherit an abstract class system. web. sessionstate. sessionstatestoreproviderbase.
However, Microsoft defines all three storage mechanismsProgramWe can't use the set, so we thought of compatibility. Just like the compatible conversion in XXX mode, I defined a mysessionstatestoreprovider to inherit the system. web. sessionstate. sessionstatestoreproviderbase, and then implement system. web. sessionstate. all derived members of sessionstatestoreproviderbase can be converted to mysessionstatestoreprovider. The simplest way to achieve this is to define a private variable system in mysessionstatestoreprovider. web. sessionstate. sessionstatestoreproviderbase, so that we can implement it. In this step, we can look at system. web. sessionstate. sessionstatestoreproviderbase defines the abstract method,

O (Saturday) o you can't afford to hurt me when I go to work on Saturday. I suggest you go back and finish it later ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.