Asp.net slide2

30 260 0
Asp.net slide2

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Asp.net slide

Session 3Objects in ASP.NET Exploring ASP.NET / Session 3 / 2 of 30ReviewActive Server Pages (ASP) is a server-side scripting environment that provides a web server with the capability to process application logic, and return standard HTML pages to the browser. Web Forms provides a form designer, an editor and debugging tools, which can be used to rapidly build server-based, programmable user interfaces for browsers and Web client devices.The Design view displays the page layout of the web page as it would be displayed in the browser.The HTML view displays the code that is automatically generated to create the Web page. AssemblyInfo.cs is the file that contains information about the project. It contains information such as name, version, and culture information.Once the code has been compiled, the CLR further compiles the IL to native code, when the request for the web page is encountered, providing improved performance. Exploring ASP.NET / Session 3 / 3 of 30Review Contd…Web.config is an XML based file. It holds unique configuration information about each URL used in the project. Global.asax is an optional file that is used for handling application-level events.The web page created either using the editor or Web Forms, is first complied to Intermediate Language (IL), including server scripts. The different web pages of an application created using Web Forms, and the program code within it, are compiled into a single assembly / dynamic link library (.dll) file. In the editor based web application, separate dynamic link libraries (.dll's) are created for each file.The web pages created using Web Forms, will have the Codebehind attribute that informs Web Forms IDE about the code file that has to be changed whenever a change is made to the Design, or the HTML view of the Web Form. Exploring ASP.NET / Session 3 / 4 of 30ObjectivesExplain the basics of ASP.NET Discuss the process flow of a .aspx pageExplain the Page_Load eventDiscuss the IsPostBack property of the Page objectUse the Request and Response Objects Exploring ASP.NET / Session 3 / 5 of 30An ASP.NET PagePage Directive<SCRIPT> sectionPage_Load EventEvent HandlerHTML ControlWeb Control Exploring ASP.NET / Session 3 / 6 of 30An ASP.NET Page - Output Output after the Page Load Event Output after the Button Click Event Exploring ASP.NET / Session 3 / 7 of 30Starting with ASP.NET <%@ Page Language=”C#” %> <script language = "C#" runat="server"></script> Exploring ASP.NET / Session 3 / 8 of 30<input type="button" id="Submit" runat="server" value="Click"/><asp:button id=”Submit” onclick="click_button" text="Click me" runat="server"/> User Interface Exploring ASP.NET / Session 3 / 9 of 30LABELClick MeHello Worldvoid click_btn(Object sender, EventArgs e){lbl.Text="Hello World";}Event Handlers Exploring ASP.NET / Session 3 / 10 of 30Event Handlers - Example <% @ Page Language = "C#" Debug = "true"%><html><script language = "C#" runat="server"> void Page_Load(Object sender, EventArgs e) {//code for page load } void buttonRefresh(Object sender, EventArgs e) { Page_Load(sender,e); } [...]... Postback 5b 4 HTM L Page HTM L Page 7 5a User causes Postback Exploring ASP.NET / Session 3 / 14 of 30 ASP.NET Objects Exploring ASP.NET / Session 3 / 15 of 30 ASP.NET Objects – More Details Exploring ASP.NET / Session 3 / 16 of 30 ASP.NET Objects – More Details Contd… Exploring ASP.NET / Session 3 / 17 of 30 Virtual Directories  ASP.NET application is a collection of text files that are stored in a... onclick="buttonRefresh" text="Refresh" runat="server"/> Exploring ASP.NET / Session 3 / 11 of 30 _VIEWSTATE Name King Name E-E- mail K@usa.net mail Password Password ****** Submit Submit Exploring ASP.NET / Session 3 / 12 of 30 Page_Load Event Database Hello World Exploring ASP.NET / Session 3 / 13 of 30 Process Flow HTTP Request Execution on the server 3 1&2 6 Changes... runat="server"> void Page_Load( Object src,EventArgs e) { String s,s1; s= Request.Form.Get ("name"); Response.Write ("Hi " + s + ", Welcome to ASP.NET! "); } Exploring ASP.NET / Session 3 / 27 of 30 Request & Response Exploring ASP.NET / Session 3 / 28 of 30 Summary    The @ Page directive is used to specify attributes that affect the code in the aspx page The ... possible to check whether a aspx page is posted back to the server with the help of the IsPostBack property of the page Exploring ASP.NET / Session 3 / 29 of 30 Summary Contd…  ASP.NET has several built-in objects that are used to provide the required functionality in an ASP.NET application They are the following:           Request Response Application Session Server ObjectContext The base... through a series of requests-andresponses Exploring ASP.NET / Session 3 / 23 of 30 Request & Response      A request contains information about the client and some parameters These parameters are essentially the data that is passed from the client, and is to be processed at the server A response contains the information requested by the client browser ASP.NET recognizes this request-and-response communication... id= txtName name=name> Exploring ASP.NET / Session 3 / 25 of 30 Request & Response - Example Enter your country name Exploring ASP.NET / Session 3 / 26 of 30 Request & Response... permissions and user access  The advantage of using a virtual directory is that the user does not have to know the exact path of a page when making a request Exploring ASP.NET / Session 3 / 18 of 30 Virtual Directory - Permissions Permissions Exploring ASP.NET / Session 3 / 19 of 30 Creating Virtual Directory To create a virtual directory : • • • • Open the Internet Services Manager MMC snap in Expand Server... the Virtual Directory Creation Wizard Exploring ASP.NET / Session 3 / 20 of 30 Creating Virtual Directory Contd… • Enter an alias in the Virtual Directory Alias screen Click Next • Type in or Browse the physical path of the application root directory (which contains the files for the web site) in the Web Site Content Directory screen Click Next Exploring ASP.NET / Session 3 / 21 of 30 Creating Virtual... response messages of the HTTP protocol The Request object corresponds to the request message of the HTTP protocol, and the Response object corresponds to the response message of the HTTP protocol Exploring ASP.NET / Session 3 / 24 of 30 Request & Response - Example Input.htm Input Page . Exploring ASP. NET / Session 3 / 15 of 3 0ASP. NET Objects Exploring ASP. NET / Session 3 / 16 of 3 0ASP. NET Objects – More Details Exploring ASP. NET / Session. Exploring ASP. NET / Session 3 / 5 of 30An ASP. NET PagePage Directive<SCRIPT> sectionPage_Load EventEvent HandlerHTML ControlWeb Control Exploring ASP. NET

Ngày đăng: 15/11/2012, 14:44

Tài liệu cùng người dùng

Tài liệu liên quan