First, pagination effect
1, get the parameter: After the URL with a question mark to give the name of the parameters and parameters to be passed, such as: [? page=3]
Http://www.xxx.com/RNewsM.sapx?page=1//In the Open rnewsm.sapx page is a get pass-through method that passes the value of page equals 1 to the page.
2. Get the parameters passed by the Get Pass method:
PageIndex = request.querystring["page"] = = null? 1:convert.toint32 (request.querystring["page"]. ToString ())
Where: request.querystring["page"]//Gets the value of [page] passed by the Get pass method.
3. SELECT row_number () over (ORDER by NewsId) as RowNumber from Rnews
Gets the record number in rnews sorted by NewSID, which is the basis for paging.
such as: SELECT TOP ten * from
(SELECT row_number () over (ORDER by ZP_CHKFLD) as rownumber,* from Zp_bm_check) A
WHERE RowNumber > 10* (3-1)
A record set with a record number for the Zp_bm_check table that was first obtained---the subquery, which again queries a page for the record content to be displayed for the base table.
---10* (3-1) 10 is the number of records to display per page, 3 is the third page, and 1 is the offset of the page number.
---Top 10 indicates that only the first 10 records that meet the criteria are read.
Second, save the state
1. Practical method of Session
session["username"]=username; Save user name after login
if (session["username"] = = NULL)//The page is opened to determine whether to log in
{
Response.Redirect ("Login.aspx"); Return to the login page without logging in
}
The session is stored on the server side of the session pool (with key and value), the Request information (Request message) is placed within the request, the corresponding information (the corresponding message) is placed in the response, The request message and the corresponding message are placed in context object contexts. The key sent back by the server is stored in the client browser's cache, so it is not available to close the page without key,session.
The session is saved by default for 20 minutes on the server and can be modified in Web. config.
2. Practical methods of cookies
response.cookies["username"]. Value = Username; Set a cookie called username
if (request.cookies["username"] = = null)//When the page is opened it is determined that there is a specified cookie
{
Response.Redirect ("Login.aspx"); Return to the login page without specifying a cookie
}
* * After the client wants the server side to send the request, the service side returns the value of the cookie to the client, which is saved in the browser's cache by default (no expiration time is set). If the cookie expires, the cookie is saved on the client's hard disk until the expiration time expires or the cookie is deleted manually.
Built-in objects