Beruflich Dokumente
Kultur Dokumente
NET
Module Subtitle
Objectives
Introduction
to ASP.NET
Advanced ASP.NET
ASP.NET
Contents
Section Section
Section
Section
Web Forms and Web Services Working with Data ASP to ASP.NET Migration
Appendix:
Section 1: Overview
Looking
ASP.NET
is ASP?
What
Databases
layout (HTML) and logic (scripting code) ASP code leads to performance loss
Interpreting Uses
Browser No
compatibility
Update
IIS
services provided by the .NET Framework is compiled the first time a page is requested management use of programming languages files while the server is running!
Cross-language integration
Update
Section 2: Architecture
The
Web
Configuration Class
Hierarchy
HTTP Runtime
Managed
code
Aims
Replaces
ISAPI
module pipeline
All requests are routed through the same pipeline Add modules through Web.Config
Request
handler
Hierarchical Configuration
Configuration
file: Web.Config
Influence
Sub Dir2
Web.Config sample
<configuration> <configSections> <sectionGroup name=system.web> <section name=httpmodules type=System.Web.Configuration. HttpModulesConfigurationHandler/> <section name=sessionstate type=System.Web.SessionState. SessionStateSectionHandler/> </sectionGroup> </configSections> <system.web> <httpmodules> <add type=System.Web.State.SessionStateModule name=Session> </httpmodules> <sessionstate cookieless=true timeout=20/> <system.web> </configuration>
Custom Configuration
Default
%windir%\Microsoft.NET\Framework\<version>\CONFIG
Standard set of configuration section handlers
Customized
configuration
Extend the set of section handlers with your own Implement the interface:
System.Configuration.IConfigurationSectionHandler
Problems
with
Hierarchically structured Dot-syntax, grouping classes logically Abstract base classes and class implementations
Sample: System.Web.UI.WebControls.Button
namespace class name
WebControl
Table
Button TextBox ...
Section 3: Features
ASP.NET
Samples
Execution
Assemblies State
Completely
No implementation code within HTML files Files for designers and files for programmers You can still mix HTML and scripting code if you wish
.cs .aspx.cs
.aspx
Supported Languages
Visual
Basic
VBScript is unmanaged !
JScript C#
C++
Others:
C# Overview
New
Hello
World sample
using System; namespace hwsample { public class Hello { public static void Main() { Console.WriteLine(Hello World!); } } }
QuickStart
Different
All
The
Code
Declaration Blocks
Code
Render Blocks
[ inline code or expression ]
<% %>
HTML
Control Syntax
Control Syntax
Subproperty
Binding Expression
Server-side
Object Tags
Server-side
Server-side
IIS
ASP.NET Runtime
Parse .aspx file Generate page class
Code behind
Instantiate controls
Response
Execution process
Compilation, Microsoft
Assembly languagelike style CPU independent Provides a hardware abstraction layer MSIL is executed by the common language runtime
Common
language runtime
Assemblies
Result
Assembly 2
MyApp.dll
metadata
metadata
Metadata
An
assemblys manifest
A manifest contains
Locate and load class types Lay out object instances in memory Resolve method invocations and field references Translate MSIL to native code Enforce security
State
What is an application?
Global information
Implementation rules
Use of system resources Lock and unlock your global information Beware of global variables in multithreaded environments Loss of state when host is destroyed No state sharing across Web farms
State
What is a session?
Functionality
Request identification and classification Store data across multiple requests Session events Release of session data
Security 1/3
Reasons
for Security
Prevent access to areas of your Web server Record and store secure relevant user data
Security
Configuration in Web.Config
Authorization, Impersonation
Authentication, Code
Access Security
Are you the code you told me you are? Protect your server from bad code
Security 2/3
Authentication
Types of authentication
Windows, integrating with IIS 5.0 Passport, centralized services provided by Microsoft Forms, request attachment
Authorization
Security 3/3
Impersonation
Code
Access Security
Event Handling
Web Forms
Delegate
Model
Connect event sender and event receiver Single and multicast delegates
Event Event
Web Client
event
Event Samples
Event
samples
System.Web.UI.WebControls
System.Web.UI
in C#
<asp:ImageButton id=btnNext runat=server imageurl=... onclick=btnNext_Click/>
ASP.NET
C#
Server
Working Web
Migrating
thisfile.aspx.cs
SubmitBtn_Click() { ...
Use any .NET programming language Provides a rich set of server-side controls
Run
Visual
System.Web.UI.WebControls
Web Services
Black
Exposed
To
the most part, similar to COM programming on simple, open standards = Messaging
Based
XML-based communication
Communication Client
URLthe
http://<serverName>/<VirtualDir>/ <fileName>/<methodName>?var=value
Web
Transactions
public class MyClass : System.Web.Services.WebServices { [ WebMethod ] public int Compute1(int i1, int i2) { return i1 + i2; }
public int Compute2(int i1, int i2) { if (i1 > i2) return i1 - i2; else return i2 - i1; } }
Server
Mobile
Data Page
Binding Class
Server Controls
ASP.NET
Server Controls
Abstract controls
Controls
Required entry
User
Controls (Pagelets)
Mobile
Controls
ASP.NET Syntax
controlName
attributes
Id=controlID runat=server
Managed Essential
Namespaces
Overview
Internet XML
ShoppingCart.CalculateOrderSummary();
DataRow row = ShoppingCart.OrderSummary.Rows[0]; lblSubTotal.Text = System.String.Format({0:C}, row[OrderData.SUB_TOTAL_FIELD]); ASP.NET: <table width=100%> <tr><td> <asp:Label id=lblSubTotal runat=server> </asp:label> </td></tr> </table>
Caching
Enhance Output
Caching
Expiration Cache
Rules
APIs
Web Applications
ASP.NET
sum of all files, pages, handlers, modules, and executable code that can be invoked or run in the scope of a given virtual directory on a web application server
Distributed Presentation
Web Form
Applications
Middle Tier Internet Database
Web Service
and ASP.NET can coexist on the same server use of ASP.NET features
Make To
Performance
Migration Issues
Structure
Security
Languages
Data
Access
ADO to ADO.NET
Summary
Now
Security
State Management Accessing Data
Web Applications
Migration
Questions?
Duwamish Books
A Sample Application for Microsoft.NET
Location
Location
Directory .\EnterpriseSamples\DuwamishOnline VB
Installation
Microsoft Windows 2000 Server; Microsoft SQL Server 2000 with English Query optional and supported
Read the Readme.htm
Defaults
Setup After
installation is complete:
Open the Duwamish.sln file with File/Open Solution Can build the sample with Build/Build Solution
Visual Studio.NET
IIS
Web SystemFramework ADO.NE T Common.Data
BusinessFacade
BusinessRules DataAccess
Database
Common Components
Duwamish7.Common
Namespace Duwamish.Common.Data
Duwamish7.SystemFramework
Diagnostics utilities Pre and post condition checking classes Dynamic configuration In short:
Duwamish7.DataAccess
Contains Uses
ADO.NET architecture
Optimized
Duwamish7.BusinessRules
Implements
All
Duwamish7.BusinessFacade
Implements
Reads Data
BusinessFacade
functionality
Duwamish7.Web
Implements Uses
ASP.NET architecture
Employs Web Forms model Uses code behind forms Manages state Uses custom Web controls
All
Duwamish in Action
Exploring Duwamish.Web
Exploring
Legal Notices
Unpublished work. 2001 Microsoft Corporation. All rights reserved. Microsoft, JScript, Visual Basic, Visual Studio, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.