ASP net By Sridhar_Sidhu

Category: Education

Presentation Description

First demon presentation online


Presentation Transcript



Microsoft .NET Framework:

Common Language Runtime Base Framework Classes Microsoft .NET Framework Data and XML Classes C# VB.NET J# C++ … XML Web Services Web Forms Windows Forms ASP.NET


Overview IIS (Web Server) Internet ASP.NET Runtime (ISAPI) Http Application Http Module (OutputCache) Http Module (Authentication) Http Module (Authorization) Http Handler (.aspx) MyPage.aspx Page HtmlForm Button TextBox

ASP.NET Application:

ASP.NET Application Resides in a folder on a web server (IIS) The web site is configured for ASP.NET, meaning it is set to handle .aspx page requests by sending them to the ASP.NET Runtime web.config application configuration file Aspx files .dll assembly of compiled codebehind and other classes

Global Programming (Global.asax):

Global Programming (Global.asax) Define Application Global methods, constants, variables Global Event Handling Application_Start Session_Start Application_BeginRequest Application_AuthenticateRequest Useful for setting up custom Page.User and roles Application_Error Session_End Application_End

ASP.NET Application Configuration:

ASP.NET Application Configuration Settings in machine.config Settings in web.config <customErrors> <trace> <sessionState> <appSettings> <add> key attribute value attribute Security Settings <authentication> <authorization> <identity>

ASP.NET Security Configuration:

ASP.NET Security Configuration <authentication> Windows Forms Passport <authorization> <allow> <deny> <identity> impersonate attribute userName and password attributes Can be stored encrypted in the registry

ASP.NET Application Security:

ASP.NET Application Security Page.User Identity GenericPrincipal and Roles PrincipalPermission and IsInRole IIS Configuration Interaction with Application Security Integrated, Basic, Digest, Kerberos Accessing Backend Resources (Architecture)


System.Web.UI.Page ASP.NET Web Page Consists of An .aspx page An optional .NET class file containing code for that page Any user controls used by the page Think of the page as an object Controls are object variables Access them in code Inline (Inferior) Code is interspersed with HTML Code Behind (Superior) Code resides in a separate class file

The Page Directive:

The Page Directive Defines page-specific (.aspx file) attributes used by the ASP.NET page parser and compiler. Example showing an .aspx page mapped to its code behind: <%@ Page Codebehind="WebForm1.aspx.vb" inherits="AspNet.WebForm1" %>

Server-Side Events:

Server-Side Events MyPage.aspx Private Sub btnGo_Click(…) End Sub Search Server Client PostBack

Event flow in ASP.NET pages (.aspx):

Event flow in ASP.NET pages (.aspx) Application Level Events (Global.asax) Page_Init: page and controls are initialized Page_Load: all the controls and page are loaded Change events for controls are processed Click events for controls are processed Page_PreRender: page is about to render Page_Unload: page is unloaded from memory

Controls :

Controls WebForm Controls HTML Controls Web User Controls Custom Controls

PowerPoint Presentation:

What’s in the Toolbox? WebForm Controls TextBox, Label, Hyperlink, Etc DropDownList, DataGrid, DataList, Etc HTML Controls (Client or Server) ADO.NET Design Controls System Components Validation Controls

WebForm Vs HTML Controls:

WebForm Vs HTML Controls Both have the following benefits An object model that you can program against on the server 1 A set of events for which you can write sever side event handlers. 1 The ability to handle events in client script . 1 Automatic maintenance of the control's state (ViewState). 1 Interaction with validation controls so you can easily verify that a user has entered appropriate information into a control. 1 Data binding to one or more properties of the control. 1 Support for HTML 4.0 styles if the Web Forms page is displayed in a browser that supports cascading style sheets. 1 Pass-through of custom attributes. 1 HTML Controls Advantage Object model with a one-to-one mapping to HTML elements 1 WebForm Controls Advantage A richer object model that provides type-safe programming capabilities. 1 Automatic browser detection. 1 For some controls, the ability to define your own look for the control using templates. 1 For some controls, the ability to specify whether a control's event causes immediate posting to the server or is instead cached and raised when the form is submitted. 1 Ability to pass events from a nested control (such as a button in a table) to the container control. 1

PowerPoint Presentation:

Validation Controls RequiredFieldValidator CompareValidator RangeValidator RegularExpressionValidator CustomValidator ValidationSummary

Validation Controls Common Properties:

Validation Controls Common Properties ControlToValidate  This property lets the validator know which control it has to validate. (It binds the validator to that control and then the validator monitors that control.) ErrorMessage  This is the error message that appears in the validation summary when the control being validated violates the condition set by the validator. Text  Information that gives guidance to correct the error.

Page.Validate() and Page.IsValid:

Page.Validate() and Page.IsValid They allow you to trigger validation from different points in your code Validate() must be called before checking IsValid


DataBinding Populating Controls with Data Single-Value vs. Multi-Record Design-time vs. Runtime Binding

How State is Managed in a Stateless World:

How State is Managed in a Stateless World Posted Data Handling ViewState Webforms automatically handles form data and persists it across requests Hidden field with encoded data Session (in memory or a database) Cache


OutputCache Cache the HTML output of a page Increases performance Duration Location VaryByParam

Debugging ASP.NET:

Debugging ASP.NET Using Visual Studio .NET debugging tools Breakpoints Stop keyword System.Diagnostics.Debug Command/Immediate Windows Watch/Quick Watch Autos/Locals Windows Trace Client Script Debugging Active Documents Debugger keyword


Deployment Can be XCopy’d Usually only the .aspx pages and the compiled codebehind assembly

Any Quires !:

Any Quires !



authorStream Live Help