Download presentation
Presentation is loading. Please wait.
1
ASP.NET Application Framework
Sean Puffett Developer Evangelist Microsoft UK
2
Agenda Caching Data Binding Session State Configuration
Authentication Security Deployment
3
Caching Full page output caching Fragment Caching Extensible Cache API
Vary by params, language, user-agent Fragment Caching Enables portions of pages to be cached Extensible Cache API Developers can cache arbitrary objects Multiple expiration policies, file change invalidation
4
Caching - Additional Topics
Page Output Caching OutputCache Duration="60" %> Page Data Caching Cache[“MyDataSet”] = SomeDataSet Like Application Variables Scavenging Expiration Dependencies
5
demo Simple Fragment Caching
6
Data Binding Provides a simple, declarative way to bind Web UI elements to data “Simple” binding to a single property Or directly into the page “List” binding to a data source DataGrid, DropDownList, etc. Huge variety of data sources supported But… One way snapshot model Requires code to update the data source
7
Simple Binding Syntax Step 1: Set bindings
Declaratively (in HTML): <asp:Label Text=<%# custID %> … /> Step 2: Call DataBind Sub Page_Load(s As Object, e As EventArgs) Label1.DataBind() End Sub
8
Simple Binding Example
Page language=“VB” %> <script runat=server> Sub Page_Load(s as Object, e as EventArgs) Label1.DataBind() End Sub </script> <html> <body> <asp:Label id=Label1 runat=server Text=<%# DateTime.Now %> /> </body> </html>
9
Binding Data To Lists DataGrid, DropDownList, etc.
Supported DataSources ADO.NET Connected: DataReader ADO.NET Cached: DataSet, DataTable, DataView Also other IEnumerable types: ArrayList, Array Hashtable Result of a method
10
List Binding Syntax Step 1: Set bindings DataGrid1.DataSource=ds;
Declaratively (in HTML): <asp:DataGrid DataSource=<%# ds %> … /> Imperatively (in code): DataGrid1.DataSource=ds; Step 2: Call DataBind Sub Page_Load(s As Object, e As EventArgs) DataGrid1.DataBind() End Sub
11
demo Data Binding A DataGrid Control
12
Session State 3 Modes of Session State In-Proc StateServer SqlServer
Stores values in the memory of the ASP.NET Worker Process StateServer Uses a Microsoft Windows Service to store Session Variables SqlServer Uses one or more SQL Servers to store Session Variables
13
Session Variables Store state information No longer require Cookies
Share between servers <sessionstate inproc="false" server=“AnotherServer" port="42424" />
14
Scale-Out Web Architecture
Session state supports web farms Applications no longer tied to one machine Single state server supports multiple app servers Multiple Session State providers ASP.NET state server SQL Server
15
demo In-Proc Session State
16
Configuration Stored in XML file in directory with pages
web.config Contains all ASP.NET settings Authentication, compile options, custom error pages, etc. Allows adding Application settings DSN, etc. Extensible Can extend with custom configuration data Overrides/Adds to settings in machine.config
17
IBuySpy Configuration
<appSettings> <add key="DSN" value=“data source=ibs2;Trusted_Connection=yes" /> </appSettings> <location path="CheckOut.aspx"> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> <authentication mode="Forms"> <forms name="IBuySpyAuth" loginUrl="Login.aspx" protection="all"> </authentication> <customErrors mode="RemoteOnly" defaultRedirect="ErrorPage.aspx"/> </configuration> <appSettings> <add key="DSN" value="data source=ibs2;Trusted_Connection=yes" /> </appSettings> <location path="CheckOut.aspx"> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> <authentication mode="Forms"> <forms name="IBuySpyAuth" loginUrl="Login.aspx“ protection="all“> </authentication> <customErrors mode="RemoteOnly" defaultRedirect="ErrorPage.aspx"/>
18
ASP.NET Authorisation Basic, Digest and NTLM leverage IIS
Credential verification against Active Directory Passport module provided Exposes passport profile API Custom, forms-based authentication Easy to use, with cookie token tracking Custom login screen (no popup dialogs) Credential checks against database, etc.
19
demo Introducing Forms Authentication
20
Deployment - with ASP DLL Locking MTS/COM+ Registry Page hit
Shutdown web application Shutdown Internet information Server Edit in Visual Interdev MTS/COM+ Shutdown package Binary compatibility Registry
21
Deployment - with .NET “XCopy” Deployment Supports all web resources
Components in .\bin No registration required for components No Locked DLLs (Server stop not required) Supports all web resources Web pages, web services Compiled components (DLL) Configuration files
22
Deployment - continued
Update running apps Simply copy DLL on top of old ones Application gracefully migrated to new code Old application stopped when all users have closed the session Applications are Isolated Each application can have its own version Uninstall Delete
23
demo Replacing A Running Assembly
24
Summary Caching Data Binding Session State Configuration
Authentication Security Deployment
25
Useful Resources Walkthrough: Using a DataGrid Web Control to Read and Write Data: INFO: ASP.NET State Management Overview Book: Essential ASP.NET by Fritz Onion (ISBN: )
26
Additional Information
Post Events Site All information on past events, slide decks etc The UK MSDN Site & Flash Local news, events, webcasts Register to received the bi-weekly MSDN Flash by GotDotNet and ASP.NET – lots of excellent resources
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.