developing an asp.net application and using the mobile internet toolkit bart vande ghinste...
TRANSCRIPT
Developing an ASP.NET Application and using the Mobile Internet Toolkit
Bart Vande [email protected] ConsultantMicrosoft Belux
2
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
3
PresentationPresentation Data Data
Architectural Overview
WSFaçade(asmx)
WSFaçade(asmx)
WINService
WINService
BusinessBusiness
WSFaçade
WSFaçade
ES Façade
ES Façade
BizServices
BizServices
DAL
DAL
SPSP
or
browser
admin
reporter
ASP .NETUI
(aspx)
ASP .NETUI
(aspx)
4
Football247.net
Football247.Presentation
User Tier
Business Tier
Data Tier
SystemArchitecture
SolutionStructure
ApplicationArchitecture
.Administrator, .Reporter
.WebSite .WebControls
.WinControls
.Facades
Football247.Business
.Facades .Host
.Services
Football247.Data
.DataAccess
Football247.Common
.Core
.Datasets
5
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
6
Data Binding Support in ASP.NET
Binding controls to a data source
Based on the fact that most data access is read only Search Pages Displaying Team or player data
Several data sources can be used Datasets Collections IBindingList Interface
You can assign data to any run-time accessible property Display Text
TextBox, Button etc. Target Page of link controls Also Width, Height, BgColor, Class…
7
Data Binding Support in VS.NET
Different types of data binding Multi Record Controls
Repeater DataList DataGrid …
Single Value Controls Label TextBox …
HTML Server Controls Data Binding Expressions
Design Time versus Run Time Binding Use the DataBinding Event to bind during Run Time Combine Design Time and Run Time
8
Data Binding Support in ASP.NET
9
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
10
Validating User InputValidation Controls
Validation Controls can validate HTML Controls Web Server Controls
Validation happens when Click events are processed Page.IsValid Property Multiple conditions are tested with a Logical AND Programmatically by calling Validate Method
Types of Validation
Type Control
Required Entry RequiredFieldValidator
Value Comparison CompareValidator
Range Checking RangeValidator
Pattern Matching RegularExpressionValidator
User Defined CustomValidator
11
Validating User InputValidation Controls
Server-Side and Client-Side Validation Always Server-Side Also Client-Side if browser supports DHTML
Custom Validation Complete Control over Format and location to place output BaseValidator Control
Displaying Error Information
Display Option Error Output Location
In Place Next to Validated Control
Summary In one dedicated place
In Place and Summary Show shorter message or glyph in place, detailed message at other location
Custom Full Control
12
Validating User Input
13
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
14
Authentication and Authorization
Authentication is process of obtaining credentials and validating against some authority
Authorization is to determine if identity is granted access to a resource File Authorization URL Authorization
Impersonation is acting of behalf of the calling Identity Authentication Providers in ASP.NETAuthentication Provider Description
Forms Authentication Unauthenticated request are redirected to HTML Form acquiring user credentials
Passport Authentication Centralized Authentication Service
Windows Authentication Provided by IIS Basic Digest Integrated with NTML or Kerberos
15
Forms Authentication
IISIIS
Browser
Forms Authentication Module
Forms Authentication Module
Get Shop.aspx
Redirect SignIn.aspx
Post SignIn.aspxAuthenticate Credentials
BUSINESS
FACADE
BUSINESS
FACADE
Authentication Data
Set Cookie + Redirect
Get Shop.aspx Global.asaxAuthenticateRequestContext.User = Principal
Global.asaxAuthenticateRequestContext.User = Principal
web.configweb.config
16
Forms Authentication
<authentication mode="forms"> <forms forms=".ASPXFOOTBALL247" loginurl="/SignIn.aspx" protection=“All“ timeout=“60“ />
<location path="Shop.aspx"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web></location>
Web.config
Configuration
FormsAuthentication Utility Class SignOut Encrypt/Decrypt GetRedirectURL …
17
ASP.NET Authorization
File Authorization Handled by the FileAuthorizationModule Active when using Windows Authentication Checks the ACL
URL Authorization Handled by the URLAuthorizationModule Maps Users and Roles to URI namespace
Special Identities
<authorization> <allow roles=“Reporter"/> <deny verb=“POST” users=“John” /> <deny users=“*” /></authorization>
Web.config
Identity Description
* Refers to all identities
? Refers to the anonymous identity
18
Authentication and Authorization
19
Agenda
Architectural Overview Handling Business Data Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
20
User Controls
Similar to Web Page User Interface Code Behind File No HTML, BODY or FORM elements Extension is .ascx
Advantages Easy to create Good for static layout Same programming technique as web pages
Disadvantages No UI in VS.NET Limited Visual Design Support Separate copy of control is required in each application Cannot be added to the toolbox in VS.NET
21
User Controls
22
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
23
Server Controls
Compiled Component Resides in an Assembly Can be signed and versioned Can be placed in the GAC
Advantages Full Visual Design Support in VS.NET
UI in Design Mode Custom Editors
Only a single copy is required Good for dynamic layout Can be added to the toolbox in VS.NET
Disadvantages Harder to create compared to User Controls
24
Server Controls
25
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
26
client-sideapplications
codeweb pages
Visual Studio.NETVisual Studio.NET
.NET Framework.NET Framework
Mobile Web Browser
Mobile Web Browser
.NET CompactFramework
.NET CompactFramework
webapplications
client-sideapplications
Mobile Internet Toolkit
27
Mobile Internet Toolkit
Automatically adapts display and interaction for mobile devices Web-enabled cell phones PDA
Generates HTML, WML or CHTML
Extends VS.NET and .NET Framework Mobile Internet Designer Mobile Internet Controls Runtime
Emulators are provided by hardware manufactures
28
Mobile Internet Toolkit
29
Agenda
Architectural Overview Data Binding Validating User Input Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade
30
Tips and Tricks from the Trade
Dynamic Web Service Endpoints web.config Uri Property of Web Reference
Several HTC’s are available WebService Behaviour ToolTip Behaviour …
ASP.NET Caching with Cache Class Time based External Dependencies
DataView Component Easiest way to filter data Avoids unnecessary sorting round trips
31
Tips and Tricks from the Trade
32
Resources
http://www.football247.net Football247.Net Workspace on
http://www.gotdotnet.com http://www.asp.net http://www.swarren.net http://msdn.microsoft.com/workshop/author/behavi
ors/behaviors_node_entry.asp?frame=true
33© 2002 Microsoft Corporation. All rights reserved.© 2002 Microsoft Corporation. All rights reserved.