Chapter I 1. Understand the difference between C/S and B/S, ASP.NET is program development based on the B/S model 2.ASP. Features and Benefits of .NET (Refer to Textbook) 3. How to create a ASP.NET web program in vs2008 (vs2010)? Steps: File-->New->Project-->windows C#->ASP.NET application 4. Code separation: the foreground web page and the background C# logic language are separated,
Chapter II 1. Scripting language: server-side, client-side 1.1 Server-side scripting language Writing method 1: <scrip to remove t language="C#">... C# code .....</scrip去掉t> Writing method 2: <% %>
1.2 Client scripting language (Javascrip removes t) Writing: <scrip remove t type="text/javascrip remove t">... javascrip removes the t-code....</scrip去掉t>
Difference: Client-side scripts are sent directly to the client page and executed in the client browser. The server-side script is compiled and hidden on the server side, and then the result information is sent to the client
2.Page objects (common events and attributes) 2.1 Events: Page_Load: Automatically called when the page is loaded 2.2 Attribute: IsPostBack: Determine whether it is loaded for the first time (false: first load, true: return access)
3. Page value transfer 3.1 Value Passed Within the Page: ViewState["key") eg: storage value: ViewState["name"] = "Zhang San"; Value: string name = ViewState["name"]. ToString(); 3.2 Passing value between pages 1. Page A jumps to B: Add the PostBackUrl="B.aspx" attribute to the button in A 2. Background code on page B: PreviousPage.FindControl("Control ID of page A");
Chapter III 1. Common controls: text box, drop-down box, radio selection, check, button... 2. Verify controls:
Chapter IV 1. Response object 1.1 Redirect(URL); Method: Page jump 1.2 Write("html tag"); Method: Display the content of the response page 1.3 End(); Method: Stop responding to page content 2. Request object 2.1 Attribute: QueryString["key"]: Get the parameters passed in the URL 2.2 Function: Pass value between pages Steps: 1. A page dot button: Response.Redirect(B.aspx?Variable Name 1=Value 1&Variable Name 2=Value2&... ); 2. Page B gets value: Request.QueryString["Variable Name 1"] 3. Server object 3.1 Server.HTMLEncode("html tag"); Encode the html tag so that it is in string form 3.2 Server.UrlEncode("url path"); Encode the URL string 3.3 Server.MapPath("url path"); Returns the absolute physical path to that URL path
Chapter 5 1. Application object: Application set object, which exists throughout the program running (global variable) Application variable usage: application["variable name"] = value; 2. Cookie objects: Different customers have different objects, and the stored information can be saved on the client. There are 2 types of cookies: 1. Saved in memory, the user disappears when they leave; 2。 It is saved in the form of a txt file in the client cookies folder, and the storage time can be customized. How to use cookie object variables 1. Define the cookie object HttpCookie cookie = new HttpCookie(“key”,”value”); 2. Add a cookie to the Response object Response.Cookies.Add(cookie); 2.2 (Saved as a txt file under a special folder on the client) Cookie.Expires = DateTime.Now.Add("Time to Save"); 3. Read the content of the cookie object string strValue = Request.Cookies[“key”]. Value;
3. Session object: Different customers have different objects, which exist after the user logs in and disappears after exit. Session variable usage method: Session ["variable name"] = value; Common Properties of Session: SessionID: Each user has their own unique SessionID Timeout: Set the user timeout time, unit: minutes, the user will automatically exit (clear session) if the user does not operate within the specified time, the default time is 20 minutes, you can change it in the aspx file: <% session.Timeout=10 %> Session method: Abandon()
ASP.NET知识点.doc
(29 KB, Number of downloads: 0, Selling price: 1 Grain MB)
|