16
Introducing ASP+ Scott Mitchell [email protected] http://www.4GuysFromRolla.com/ http://www.ASPMessageboard.com/ http://www.ASPFAQs.com/

Introducing ASP+ Scott Mitchell [email protected]

Embed Size (px)

Citation preview

Page 1: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Introducing ASP+

Scott [email protected]

http://www.4GuysFromRolla.com/

http://www.ASPMessageboard.com/

http://www.ASPFAQs.com/

Page 2: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

The Evolution of the WebStatic Web Pages

Content was static. To alter the look and feel of a Web page, a programmer had to physically alter the contents of the page itself.

The static nature of the Web at this time removed any possibility of a user interacting with a Web site or interaction among Web sites.

Performance was great and development easy, but the Web lacked any real usability.

Dynamic Scripts

Dynamic scripts allowed for user interaction with a Web site. Web content could be dynamically generated based on a number of variables, such as user input. Allowed for the Web to serve as an application medium.

Development was anything but easy. The scripting nature of development led to poor programming practices and “messy” code. Also, interaction among Web sites was possible, but limited and difficult.

Distributed, Compiled Programs

Web pages are actual, programs created using object-oriented programming techniques. These programs are compiled instead of interpreted like the scripts of the past.

A focus on Inter-Web server communication allows developers to build truly distributed applications on the Web.

Page 3: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Problems with ASP Today• Nasty code - content and code are helplessly mixed as code

snippets are sprinkled around HTML blocks.• Deploying an ASP application is difficult, potentially requiring

setting changes to the IIS metabase and registration of various COM components.

• Common tasks, such as server-side form validation, displaying database results, caching data, user authentication, uploading binary files, etc., are difficult.

• Scripting languages offer poorer performance and encourage more spaghetti-like code than their compiled counterparts.

• Terrible (terrible!!!) debugging support…

Page 4: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

ASP+ to the Rescue!• ASP+ pages are created with the syntax of modern, compiled

programming languages - either VB (not VBScript), JScript.NET, C#, or others.

• The registry is no more. Components no longer need to be registered. Deployment is as simple as XCOPY

• ASP+ provides several, customizable, server-side controls for common tasks: validation, file upload, database display, etc.

• ASP+ provides mechanisms for inter-Web server communication, regardless of the Web server or platform.

• Exceptional debugging tools and options.

Page 5: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

The Makeup of ASP+

ASP+ Web Pages

ASP+ Web Services

ASP+ Application Layer

Page 6: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

ASP+ Web Pages

• These serve the same purpose as ASP pages today: a dynamic Web page users can visit via the Internet.

• ASP+ pages have a .aspx extension, and are text files, just like ASP pages. In fact, they can be created to look remarkably like ASP. (Show demo1.aspx…)

• ASP+ pages do not support VBScript. Rather, pages are created with full-blown VB 7 (or JScript.NET or C#).

Page 7: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Changes from VB6 to VB7

• No more default properties for objects: objRS(“columnName”) will generate an error, must use: objRS.Fields(“columnName”).Value

• As a consequence, Set and Let are no longer supported.

• All calls to subroutines must have parenthesis

• Variables can be dimensioned and initialized simultaneously: Dim i as Integer = 4

• Error handling now uses Try … Catch … Finally blocks as opposed to On Error Goto.

• VB7 is (finally) a real OOP language. Now possible to use polymorphism and true inheritance.

Page 8: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Changes from ASP Coding Styles to ASP+ Coding Styles

• All functions and subs must exist in <SCRIPT RUNAT=“server”> blocks (functions cannot exist in the inline code (<% … %>)).

• ASP+ design encourages use of post-back forms• ASP+ offers server controls. These controls

provide an object model developers can program against.

• ASP+ pages are designed to be event-driven as opposed to procedural-based.

Page 9: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

ASP+: Write Less Code

• Collecting and acting on user input… a comparative look at ASP and ASP+ (create/run demo)

• Note the use of HTML server controls in the ASP+ page. These are created by adding the runat=“server” property to standard HTML tags…

• Note that we can wire up events in the server controls

Page 10: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Server-Side Validation Example

• With ASP, server-side validation was oft-repeated and a ton of code…

• ASP+ introduces a number of Validation controls to ease the task of validating form input.

• Show ValidationDemo.aspx• For more info, visit:

http://www.4guysfromrolla.com/webtech/090200-1.shtml

Page 11: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Web Services: Inter-Server Communication

SERVER

CLIENT

HTML

SERVER

SERVER

SERVER

XML

XML

XMLXML

XML

CLIENT

XML

XML

Page 12: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Creating Web Services with ASP+

• Creating Web Services with ASP+ is as simple as creating a class (show Math.asmx demo).

• Web service files have an .asmx extension.• ASP+ creates a default description page for a

given .asmx file (show demo by visiting http://localhost/aspugtalk/Math.asmx).

• An .asmx files SDL (service description language) can be viewed by visiting the .asmx file and appending ?sdl to the QueryString.

Page 13: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Inter-Server Communication

SERVERINTIATINGCOMMUN-ICATION

SERVERRECEIVINGCOMMUN-ICATIONREQUEST

Via HTTP Protocol, a Discovery request is sent (DISCO)

Server returns Service Description Language (SDL), describing Web service

Sends SOAP Request in format specified in SDL

Sends SOAP Response, communications complete

Page 14: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

Calling a Web Service from an ASP+ Page

• A proxy class must be created based on the Web service’s SDL. This task can be automated by WebServiceUtil.exe (show Proxy class creation demo)

• This proxy class must then be compiled into a DLL (show compilation of proxy class) and moved into the \bin directory

• The Web service can then be accessed programmatically from an ASP+ page (demo: show AccessMathProxy.aspx)

Page 15: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

In Conclusion...

• ASP+ is an entirely new way to create interactive, distributed Web applications.

• ASP+ enables developers to write more powerful applications with fewer lines of code.

• ASP+ addresses many of the disadvantages of ASP.

• ASP+ Web services allow for developers to create truly distributed applications running over standard protocols.

Page 16: Introducing ASP+ Scott Mitchell mitchell@4guysfromrolla.com

To Learn More about ASP+

• Download the pre-beta bits at: http://msdn.microsoft.com/net/

• Pick up a copy of Wrox’s A Preview to ASP+ (Anderson, Homer, Howard, and Sussman)

• Visit the many great ASP Web sites:

4GuysFromRolla.com, ASPFree.com, ASP101.com, ASPNG.com

• Have your ASP+ Questions Answered at:

ASPMessageboard.com, ASPLists.com