Response, Request, QueryString, repeater add, modify, and delete data, response. querystring

Source: Internet
Author: User

Response, Request, QueryString, repeater add, modify, and delete data, response. querystring

Built-in object:

Response object: Response request. The Response object is used to dynamically respond to the client request, control the information sent to the user, and dynamically generate a Response.
Response. Write ("<script> alert ('added successfully! ') </Script> "); ----- A Prompt window is displayed, indicating that the instance is successfully added.
Response. Redirect ("Default. aspx ");

Request object: GET Request
Request ["key"] to obtain the passed value. The Request object interacts with the client, collects Form, Cookies, and hyperlinks of the client, or collects environment variables of the server.

QueryString: What is data transfer in the address bar? Key = value & key = value
Note: 1. If you do not need to keep confidential information, you can transfer it. it is visible and changeable in the address bar.
2. Do not pass on long things because the length is limited. Excessive length may cause data loss.

Modify to hyperlink, click to open the Default6 page, pass the UserName value to the end, and name it "un;

Received information from another page

The Request object is used.



Add and delete Functions
Home page:

Query the database, use the reapeter tool to display the database information, and then delete and query the hyperlink to connect to the corresponding page.

 

Modify: click Modify to upload the primary key value of the selected information to the new page.

 

 

Step: Pass the value and query the data --- assign the data to the control -- collect data changes-determine whether to return

Modified successfully. Close the refresh parent page.

 

 

Add:

Determine whether the two codes are consistent

 

 

 

 


Login status Persistence:
Cookies: click. If you select to save the password, save the password in the hard disk of the Local Computer and put it in the cookies named "user", which is equivalent to a string, followed by a digital storage time, if you do not save it for 20 minutes, or exit and close it, delete it. If you want to delete it, change the number to a negative number, which means it has expired for several days.

Protected void Page_Load (object sender, EventArgs e)
{
Button1.Click + = button#click;
}

Void button#click (object sender, EventArgs e)
{
Bool OK = new UsersData (). Select (TextBox1.Text, TextBox2.Text );
If (OK)
{
Response. Cookies ["user"]. Value = TextBox1.Text;

If (CheckBox1.Checked)
{
Response. Cookies ["user"]. Expires = DateTime. Now. AddDays (7 );
}
Response. Redirect ("Default. aspx ");
}

}

A piece of text saved on the hard drive of your computer

The http protocol includes a browser that allows websites to temporarily store data on users' computers in the form of Cookies.

If no storage time is set, session cookies
1. If you do not refresh the page again within 20 minutes, the cookies will be automatically deleted.
2. When the current access connection is interrupted, such as closing the browser, the cookies will be automatically deleted.

Purpose:
Maintain the user's login status

Related Article

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.