函數執行順序 具體可參閱微軟官方文檔:Asp.Net頁面生存週期概述
Init事件(): Use this event to read or initialize control properties.
load() Use the OnLoad event method to set properties in controls and to establish database connections.
Render() A user control (an .ascx file) automatically incorporates rendering, so you do not need to explicitly render the control in code.
內置對象 具體可以參考微軟官方文檔:vb內置對象 與Asp一致可做參考
- Response
作用:獲取與 Page 關聯的 HttpResponse 對象。該對象使您得以將 HTTP 響應數據發送到客戶端,幷包含有關該響應的信息。 - Request
獲取請求的頁的 HttpRequest 對象。 - Application
提供與當前應用程序相關的屬性、方法和事件,與服務器有關,無論瀏覽器如何開關。 - 補充 server:集合了服務器的信息
函數:
Server.Transfer("./webform2.aspx");執行的結果給用戶
Server.Execute("./webform2.aspx");把執行的結果顯示在本頁上一起給用戶
Response.Redirect("./webform2.aspx)先把跳轉的地址給用戶,再讓用戶去申請跳轉的地址
session
會話:一個瀏覽器連接服務器(算作一次網絡進程)就算一次會話sessionId 若沒有timeout的話始終一致
session工作原理: 當會話開始的時候 由服務器自算法生成一次sessionId
cookie
概述:保存在客戶端內存中不超過4k,交予服務器來存儲用戶數據,這使得,瀏覽器下次訪問時,只需根據網站名對應cookie內存塊就可取出服務器保存到本地的用戶數據。
注:cookie存儲數據,是用戶submit的數據,而不是本次建立session的數據
文本框autopostback
在webfrom中,textchange的事件,服務器沒辦法檢測到事件,所以需要設置Autopostback屬性,當文本改變,自動回傳屬性要True