asp + in the session of the use and principles of () does not require cookie can? / td> asp + in the session of the use and principles of () does not require cookie can? / H1> March 25,2004
| / * |
Tofu is fine
technical points such as tofu reproduced http://www.asp888.net Please keep copyright information
session management, our traditional asp program is actually a dead link of the session, the system In fact, our client has written a Cookie, when we put our browser's security settings set to Prompt When Cookie, when we Session of the page to visit a time when, there will be a Cookie whether to allow the prompt, when set to become not allowed to Cookie, we always can not succeed in Session. For example:
Session ( "username") = "tofu"
Session ( "URL") = "http://www.asp888.net"
The ASp.Net environment, Session has been completely re-defined, due to the present ASp.Net tofu PDC version of the environment,
Therefore, there is no right Beta1 version of Demo, I'm here if related to the content of Beta1 are only the material presented, tofu has not been tested
In fact, for some comrades reluctant to get to the bottom, tofu wrote: In fact, to use asp.net and asp to use exactly the same, or even more simple because, according to tofu observation, we do not have to continue to consider the client's cookie selection item state, because no matter how the client settings, session can be passed smoothly
Here we have a session on the asp.net simple mechanism for in-depth understanding, limited to technical, I have some of the issues is not very clear,
So welcome to come and study this article
In the PDC version, we open the% systemroot% complus (version) config.web file, we find sessionstate
You can see the previous content:
inproc = "true"
usesqlserver = "false"
cookieless = "false"
timeout = "20"
server = "localhost"
port = "42424"
When the inproc to True when, asp.net will adopt a mechanism known as in-process, the data stored in the Session server,
Inproc and usesqlserver at the same time, if false, then the adoption of a mechanism for out process will be stored in a session designed to save the session on the server so that you can solve the problem of different hosts to access a site, when, session sharing , the previous asp absolutely impossible.
In the Beta1 version of the config.web changed a lot, and we simply look at:
<! - Sessionstate attributes:
mode = "inproc" | "sqlserver" | "stateserver"
cookieless = "true" | "false"
timeout = <session timeout in minutes, a whole number greater than 0>
sqlconnectionstring = <acceptable values for SQLConnection.ConnectionString,
only used when mode = "sqlserver">
server = <server name, only used when mode="stateserver">
port = <port number, only used when mode="stateserver">
Config.web paper session on the part of the first, we say here, let's take a look at cookieless issues:
This is not our usual understanding of Cookieless whether the client to save Cookie observed under the tofu, ASP.net's session
Is not in the browser client of any cookie-generated we first set the cookieless be false, we take a look at this process
<% @ Page Language = "VB"%>
<% Session ( "name") = "bean"% "
<% = Session ( "name")%>
After the program execution, we did not get any from the browser prompts, even though we also used to Session
When we cookieless is set to become true after the re-run this program, we found that the implementation process is still correct, but the browser's address bar has changed, and we used to be
http://host/testsession.aspx now become the http://host/ (contains a lot of the contents of the string) / testsession.aspx
Tofu estimate that this is because the session even on the server does not generate Cookie reasons, had to use (including a lot of the contents of the string) to save the contents of the contents of the Session
When we inproc and usesqlserver are set as false that we will use out process at this time, we will specify the
The name of this server is the server to save session agreed to a server, we need the server asp state service will start
When we need to use sql server, we must fill in sql server connection string, so that session will be saved to the
sql server in a database, of course, this database should be generated, but in PDC version, I did not find the database files so the installation on this part of sql server I can do nothing, blame is not quite happy tofu, then installed a version of the PDC, and now think of it regretted: (
Through these studies, whether we asp.net's session has a better understanding of the mechanism of it?
Author: tofu (Original)