Asp. NET implementation of multi-domain multi-site Sharing Session value
1, implementation function: You can set which sites can share session value, so as to prevent others to use this to access
To implement this function, you have to put the session value into the database, all of which we first register with the VS
The following steps are required to save a Session to SQL Server:
1. First, you must create a database that saves sessiondata and use aspnet_regsql.exe as a command. The specific command is
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727> aspnet_regsql.exe-ssadd-sstype c-D sd-E
This command adds an sd database to save session data in windows Authentication
Possible solutions (I have used):1. Web. config file modifies sessionstate mode (default is InProc)"stateserver" stateconnectionstring="tcpip= 127.0.0.1:42424" sqlconnectionstring="data source=127.0.0.1; Trusted_connection=yes" cookieless="false" timeout=" - "/>2. Open The service (preferably set to automatic) of the ASP.3. serialization session to save the class [Serializable]public class UserInfo{Individual properties}For more information: ASP.
Original link: http://beidouxun.com/Articles/Details/50bd1241-bc05-43df-9cbb-d5c00ced33ac
Use the session steps in. NET core as follows:
1, installation Microsoft.AspNetCore.Session NuGet package
2, modify Startup.cs Add related services, service. Addsession () and app. Usesession ()
//This method gets called by the runtime.
Use it to add services to the container. public void Configureservices
(Domestic version)
Many people will think of using cookies (Httpcookies) To store certain data, so that the stored data can still be read from the user end when visiting another webform. However, if the user's browser does not allow cookies... Isn't that all done... Moreover, cookies can only contain 4 K bytes of data!
Dim
Democookie
As
New
Httpcookie (
"
Samplecookie
"
)
Dim
Time
As
Datetime
=
Datetime. NowDemocookie. Values. Add (
"
Time
"
, Tim
This method is not too good, the pressure on the server, because the system is internal personnel use, business is more complex, so some of the need to save the session, but the session has a failure time.The code is as follows:$ (function () { function post () { var bid = ' @ViewData ["bid] '; var cid= ' @ViewData ["CSID"]; $.ajax ({
ASP. NET: The image cannot be displayed when the Session verification code is saved in a general processing program ?,
Using System. Drawing;Using System. Web;Using System. Web. SessionState;
/// /// CaptchaHandler Summary/// Public class CaptchaHandler: IHttpHandler, IRequiresSessionState{
Public void ProcessRequest (HttpContext context){
// GDI + three steps 1 canvas 2 create a paint brush for the can
The session is saved in the server's memory.SessionID can be viewed by entering http://localhost:8888/into the Tomcat Manager app and clicking on the item's sessions to see the number and ID of the session.The following sentence explanation: Page1 did not close, double-click the browser, open a new page input page2, that is, not through the Page1 hyperlink way to access Page2, found that SessionID is still the same, the following sentence is correct.U
As the company wants to balance the server load, the web project is deployed on each of the two front-end servers (web1 and web2. However, sessions are used in the project. After logging on to web1 at the beginning, the load may increase after web1, so it is possible to jump from web1 to web2.
I have found a lot of information from the Internet, and I understand the configuration in Web. config.
Many examples on the Internet use stateconnectionstring = "TCPIP = 127.0.0.1: 42424". It is okay to d
I want to design a complete Buffer Solution
ProgramBuffer data from various locations.
Application-level cache and application.The user can understand session-level sessions, or not to mention
I want to talk about a smaller scope of application.
Thread level: cache that is valid only within a thread. For example, you can define a database connection object and buffer it at the Thread level. When performing various database operations, you don't
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.