1 / 103

.NET Fundamentals ASP.NET - Web Forms December 8, 2003

.NET Fundamentals ASP.NET - Web Forms December 8, 2003. Agenda – December 8, 2003. Homework Questions Quick Note on Namespaces ASP.NET Web Applications Simple WebTime Class Exercise Web Form GuestBook Class Exercise Homework Assignment for December 11, 2000. Topics.

ganit
Télécharger la présentation

.NET Fundamentals ASP.NET - Web Forms December 8, 2003

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. .NET FundamentalsASP.NET - Web FormsDecember 8, 2003

  2. Agenda – December 8, 2003 Homework Questions Quick Note on Namespaces ASP.NET Web Applications Simple WebTime Class Exercise Web Form GuestBook Class Exercise Homework Assignment for December 11, 2000

  3. Topics • Quick Note on Namespaces • ASP.NET Technology • ASP.NET Web Applications in Visual Studio • Visual Studio .NET Software Requirements • Internet Information Services (IIS) • Web-Based Application Development • ASP.NET Web Applications in Visual Studio • Things To Look For When Creating a .NET Web Form Project • WebTime Class Exercise • Web Forms Events • Web Controls • Web Form Database Applications • GuestBook Database Class Exercise • Local versus Web Project • Deploying Web Applications • Tic Tac Toe Homework Problem

  4. Namespaces • Arbitrary grouping • Can be more than one file • Contains at least one class file • Identified with a using statement in C# • Simplifies class declarations • Much freedom in naming (see below) using System.Microsoft.Chips.GuestBookDB;

  5. ASP.NET Technology

  6. ASP.NET Technology • Web Forms pages are built with ASP.NET technology. • ASP.NET is a unified Web platform that provides all the services necessary for you to build enterprise-class applications. • ASP.NET, in turn, is built on the .NET Framework, so the entire framework is available to any ASP.NET application. • Your applications can be authored in any language compatible with the common language runtime, including Microsoft Visual Basic, Visual C#, and JScript .NET.

  7. ASP.NET Page Framework and the Web Forms Page • The ASP.NET page framework is a programming framework that runs on a Web server to dynamically produce and manage Web Forms pages. • In Visual Studio, Web Forms provides a forms designer, editor, controls, and debugging, which together allow you to rapidly build server-based, programmable user interfaces for browsers and Web client devices. • Web Forms pages run on any browser or client device. However, you can design your Web Forms page to target a specific browser, such as Microsoft®Internet Explorer 5, and take advantage of the features of a specific browser or client device.

  8. ASP.NET Page Framework and the Web Forms Page • The ASP.NET page framework creates an abstraction of the traditional client-server Web interaction so that you can program your application using traditional methods and tools that support rapid application development (RAD) and object-oriented programming (OOP). • Within Web Forms pages you can work with HTML elements using properties, methods, and events. • The ASP.NET page framework removes the implementation details of the separation of client and server inherent in Web-based applications by presenting a unified model for responding to client events in code that runs at the server.

  9. ASP.NET Page Framework and the Web Forms Page • The framework also automatically maintains the state of a page and the controls on that page during the page processing life cycle. • The ASP.NET page framework and Web Forms pages also support server controls that encapsulate common UI functionality in easy-to-use, reusable controls. • ASP.NET supports mobile controls for Web-enabled devices such as cellular phones, handheld computers, and personal digital assistants (PDAs).

  10. XML Web Services • ASP.NET supports XML Web services. • An XML Web service is a component containing business functionality exposed through Internet protocols. • An XML Web service enables applications to exchange information between Web-based applications using standards like HTTP and XML messaging to move data across firewalls. • XML Web services are not tied to a particular component technology or object-calling convention. As a result, programs written in any language, using any component model, and running on any operating system can access XML Web services.

  11. State Management Facilities • ASP.NET provides intrinsic state management functionality that allows you to save and manage application-specific, session-specific, and developer-defined information. This information can be independent of any controls on the page. It can be shared between pages, such as customer information or the contents of a shopping cart. • ASP.NET offers distributed state facilities. You can create multiple instances of the same application on one computer or on several computers.

  12. Application Events • ASP.NET allows you to include application-level event-handling code in the optional global.asax file. You can use application events to manage application-wide information and perform orderly application startup and cleanup tasks.

  13. Compilation • All ASP.NET code, including server scripts, is compiled, which allows for strong typing, performance optimizations, and early binding, among other benefits. Once the code has been compiled, the runtime further compiles ASP.NET to native code, providing improved performance. Note:  Web Forms pages, XML Web services, and components are compiled into dynamic-link library (.dll) files. Once compiled, these files do not need to be registered on the Web server on which they run.

  14. Configuration • ASP.NET configuration settings are stored in XML-based files. Since these XML files are ASCII text files, you can read and modify them, so it is simple to make configuration changes to your Web applications. Each of your applications can have its own configuration file and you can extend the configuration scheme to suit your requirements.

  15. Deployment • Visual Studio provides a simplified mechanism for deploying applications to local or remote servers. You can install files by simply copying them to your specified application directories, or by using a more specialized and configurable deployment project.

  16. Security • When an ASP.NET application runs, it executes in the context of a special local user on the Web server, called ASPNET, with limited permissions. This enhances the security of your Web application code by restricting its access to Windows resources and processes. • ASP.NET also provides various authorization and authentication schemes for Web applications. You can easily remove, add to, or replace these schemes depending upon the needs of your application.

  17. ASP.NET Web Applications in Visual Studio

  18. ASP.NET Web Applications in Visual Studio • Visual Studio .NET allows you to create applications that leverage the power of the World Wide Web. • This includes everything from: • a traditional Web site that serves HTML pages, • to fully featured business applications that run on an intranet or the Internet, • to sophisticated business-to-business applications providing Web-based components that can exchange data using XML.

  19. Visual Studio ASP.NET Web Applications • ASP.NET is part of the .NET Framework, so that it provides access to all of the framework features. • Create ASP.NET Web applications using any .NET programming language (Visual Basic, C#, Managed Extensions for C++, and many others) and .NET debugging facilities. • Access data using ADO.NET. • Access operating system services using .NET Framework classes, and so on.

  20. Visual Studio ASP.NET Web Applications • ASP.NET Web applications run on a Web server configured with Microsoft Internet Information Services (IIS). However, you do not need to work directly with IIS. You can program IIS facilities using ASP.NET classes, and Visual Studio handles file management tasks such as creating IIS applications when needed and providing ways for you to deploy your Web applications to IIS.

  21. Where Does Visual Studio Fit In? • As with any .NET application, if you have the .NET Framework, you can create ASP.NET applications using text editors, a command-line compiler, and other simple tools. You can copy your files manually to IIS to deploy the application. • Alternatively, you can use Visual Studio. When you use Visual Studio to create Web applications, you are creating essentially the same application that you could create by hand. That is, Visual Studio does not create a different kind of Web application; the end result is still an ASP.NET Web application.

  22. Where Does Visual Studio Fit In? • The advantage of using Visual Studio is that it provides tools that make application development much faster, easier, and more reliable. These tools include: • Visual designers for Web pages with drag-and-drop controls and code (HTML) views with syntax checking. • Code-aware editors that include statement completion, syntax checking, and other IntelliSense features. • Integrated compilation and debugging. • Project management facilities for creating and managing application files, including deployment to local or remote servers.

  23. Visual Studio .NET Software Requirements

  24. Visual Studio .NET Software Requirements • Certain project types and features in Visual Studio require that specific software components, which may be listed as optional in setup, must be installed before you can use that feature or project. Some of these components must be installed on the development computer, while others can be installed on a remote computer.

  25. Identifying Software Requirement Issues The following table lists the components that must be installed on the various operating systems to perform the tasks specified. These components are not installed with Visual Studio .NET Prerequisites.

  26. Visual Studio .NET Software Requirements

  27. Visual Studio .NET Software Requirements

  28. Internet Information Services (IIS)

  29. Internet Information Services (IIS) • Internet Information Services (IIS) 6.0 is a powerful Web server, available in all versions of Microsoft Windows Server 2003, which provides a highly reliable, manageable, scalable, and secure Web application infrastructure. • IIS 6.0 enables organizations of all sizes to quickly and easily deploy Web sites and provides a high-performance platform for applications built using Microsoft ASP.NET and the Microsoft .NET Framework.

  30. Web-Based Application Development

  31. Web-Based Application Development • Creates Web content for Web browser clients • HyperText Markup Language (HTML) • Client-side scripting • Images and binary data • Web Forms (Web Form pages) • File extension .aspx • aspx (Web Form files) contain written code, event handlers, utility methods and other supporting code • .aspx.cs – C#.NET code behind page

  32. Simple HTTP Transaction • HyperText Transfer Protocol (HTTP) • Defines methods and headers which allows clients and servers exchange information in uniform way • Uniform Resource Locator (URL) • IP address indicating the location of a resource • All HTML documents have a corresponding URL • Domain Name Server (DNS) • A computer that maintains a database of hostnames and their corresponding IP addresses

  33. System Architecture • Multi-tier Applications • Web-based applications (n-tier applications) • Tiers are logical groupings of functionality • Application Client or User Tier (top level tier) • User Browser Interface to the Application • Information Tier (data tier or bottom tier) • Maintains data pertaining to the applications • Usually stores data in a relational database management systems (RDBMS) • Middle Tier • Acts as an intermediary between data in the information tier and the application's clients

  34. Creating and Running a Simple Web-Form Example • Visual Component • Clickable buttons and other GUI components which users interact • Nonvisual Component • Hidden inputs that store any data that document author specifies such as e-mail address

  35. .NET Frameworks Requires • Internet Information Services (IIS) • FrontPage Server Extensions (FPSE) • See Visual Studio .NET Software Requirements help text • Not available on: • Windows NT4 • Windows 98 • Windows Me • Windows XP Home

  36. Things To Look For When Creating a .NET Web Form Project

  37. Things To Look For When Creating a .NET Web Form Project • The project location is split: • Project Files  C:\inetput\wwwroot\ project name • Solution Files  C:\Documents and Settings\...\My Documents\Visual Studio Projects\ project name • Browser Reference: • http://localhost/ project name • C:\inetpub\wwwroot\ project name

  38. Project Files • Many Project Files and File Types located in: C:\Inetpub\wwwroot\Week7\WebTime\… • Global.asax, Global.asax.cs, Global.asax.resx • Web.Config • WebForm1.aspx  Windows Form Equivalent • WebForm1.aspx.cs  Code Behind File • WebForm1.aspx.resx or for Visual Basic.NET • WebTime.aspx, WebTime.aspx.vb, WebForm1.aspx.resx

  39. Web Forms Pages and Projects in Visual Studio • To work with a Web Forms page in Visual Studio, you use the Web Forms Designer. • The designer includes a WYSIWYG view, called Design view, for laying out the elements of the page. • Alternatively, you can switch the designer to HTML view, which gives you direct access to the ASP.NET syntax of the elements on the page. • Finally, the designer includes a code editor with Intellisense that you can use to create the page initialization and event handler code for your page.

  40. Project Files Created With Web Forms • When you create a Web project, Visual Studio constructs a Web application directory structure on the target Web server, and a project structure on your local computer. Note   You need to have appropriate privileges on the Web server computer to create and manage Web application files. The correct way to get those privileges is to be a member of the VS Developers group that is automatically created on the Web server.

  41. Project Files Created With Web Forms

  42. Project Files Created With Web Forms

  43. Solution Files • Found in a Separate Directory C:\Documents and Settings\...\My Documents\Visual Studio Projects\ project name • Visual Studio.Solution (.sln file type) WebTime.sln • Solution User Options (.suo file type) WebTime.suo

More Related