33
Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste [email protected] Developer Consultant Microsoft Belux

Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste [email protected] Developer Consultant Microsoft Belux

Embed Size (px)

Citation preview

Page 1: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

Developing an ASP.NET Application and using the Mobile Internet Toolkit

Bart Vande [email protected] ConsultantMicrosoft Belux

Page 2: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft 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

Page 3: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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)

Page 4: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 5: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 6: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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…

Page 7: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 8: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

8

Data Binding Support in ASP.NET

Page 9: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 10: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 11: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 12: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

12

Validating User Input

Page 13: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 14: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 15: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 16: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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 …

Page 17: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 18: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

18

Authentication and Authorization

Page 19: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

19

Agenda

Architectural Overview Handling Business Data Authentication and Authorization User Controls Server Controls Mobile Internet Toolkit Tips and Tricks from the Trade

Page 20: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 21: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

21

User Controls

Page 22: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 23: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 24: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

24

Server Controls

Page 25: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 26: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 27: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 28: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

28

Mobile Internet Toolkit

Page 29: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 30: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 31: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

31

Tips and Tricks from the Trade

Page 32: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

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

Page 33: Developing an ASP.NET Application and using the Mobile Internet Toolkit Bart Vande Ghinste bartvagh@microsoft.com Developer Consultant Microsoft Belux

33© 2002 Microsoft Corporation. All rights reserved.© 2002 Microsoft Corporation. All rights reserved.