ASP objects allow your servers and browsers to interact with each other, and you will routinely use one or more objects in your ASP scripts. You don't have to install anything to use them, but you have to remember to turn them on or off.
ASP
1. Set Cookies
The code is as followsCookie cookie = new Cookie ("Key", "value");
Cookie.setmaxage (60);
Sets a 60-second lifetime, and if set to a negative value, the browser process cookie (saved in memory) is invalidated when the browser is
Viewing Cookies in a browser
Let's take a look at what's saved in the browser. If you are using IE5, there is a directory of cookies in the Windows directory, there are a lot of text files, the file name is similar to Wudong@15seconds[1].txt, this
What is a cookie
A cookie is a mechanism for storing data on a remote browser side to track and identify the user. Simply put, a cookie is a text file that the Web server temporarily stores on the user's hard disk and is then read by a Web browser.
1. Cookies
Yii2 cookies are operated primarily through yii/web/request and Yii/web/response, through/yii:: $app->response->getcookies ()->add () Add cookies and read cookies via/yii:: $app->request->cookies.
1) Add a cookie
name = '
One, know the Cookies object
Cookies are a collection of data that is managed by the Web server and stored in a client computer. This data is client, server-side related. That is to say, every time a client's browser logs on to a website, the
Automatic logon is to help users to use this page multiple times, without having to enter the username and password again to log in.
Automatic login refers to a user who saves the user's login information to a cookie in a local file.
This article illustrates the Java method for reading and writing Cookie records. Share to everyone for your reference. Specifically as follows:
Write cookies, the value of the cookie can make string, list, Map,int:
Cookie Usernamecookie = new
Cookies are a useful feature that can be used to determine a state that is extremely high in the project
Copy Code code as follows:
function Setcookie (name,value)
{
var days = 30;
var exp = new Date ();
Exp.settime (Exp.gettime () +
Write cookie
document.cookie = "Cookiename=" + Escape ("content to write")
,//cookiename read cookies for the name of the cookie to be written. Returns the content
function GetCookie (cookiename) {
var cookiecontent = ' of the corresponding
Brother Bird's blog mentioned SAPI, I also look at the source.
-------------
PHP architecture diagram (photo from http://stblog.baidu-tech.com/?p=763):
Middle-tier (SAPI) decoupling of Web server and PHP
Each SAPI implementation is a _SAPI_MODULE_
A cookie is a variable that is stored in a visitor's computer. This cookie is sent whenever the same computer requests a page through the browser. You can use JavaScript to create and retrieve a cookie's value. This article mainly JS how to read
The main things that Yii does with cookies are the following:
1. Set Cookies:
$cookie = new Chttpcookie (' MyCookie ', ' This are my Cookies ');
$cookie->expire = time () +60*60*24*30; There is a period of 30 days
Yii::app
Copy Code code as follows:
Verify that the password is remembered when the page is initialized
$ (document). Ready (function () {
if ($.cookie ("rmbuser") = = "true") {
$ ("#rmbUser"). attr ("Checked", true);
$ ("#user"). Val
This example describes the use of cookie Plug-ins in jquery. Share to everyone for your reference, specific as follows:
jquery provides a lot of plug-ins, convenient, safe, fast and practical. This section is familiar with the plug-ins that operate
Some time ago trying to use jquery cookies, do a simple skin-changing function, only for small sites and code low-level.
First introduce jquery and cookie Plug-ins
Copy Code code as follows:
Prepare several CSS files
Common JavaScript function
//=========================================
Input data validation
Checking for null values
function Funcheckempty (m_text) {
var strtmp=m_text
if (strtmp = null | | strtmp = = "") {
return False
}
return True
}
Check the
asp.net examples of manipulating cookies, including creating cookies, reading cookies, and emptying cookies, can be consulted by a friend in need.
1. Create cookies
Copy Code code as follows:
HttpCookie cookie = new HttpCookie
When browsing the web, you can often see the number of "people on the current site is xxx" online count. How to use ASP to do one? First of all, the analysis of its practice, in general, these online statistics refers to the number of visitors in a
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.