Vous êtes sur la page 1sur 8

DotNet Summary

• There are four types of Internet applications: Web applications, Web services,
Internet-enabled applications, and peer-to-peer applications.
• Web applications run on a server, processing user requests for pages and
composing those pages using executable code and static resources on the server.
• Web applications can provide dynamic content based on dynamic server
resources, such as a database, and based on user inputs, such as creating a
mortgage payoff table from user loan information.
• ASP.NET is a platform for creating Web applications that run on Windows servers
using IIS and the .NET Framework.
• Web applications are made up of content, an executable, and configuration files.
• The content of a Web application is presented through Web forms. Web forms use
HTML components like conventional HTML pages; like Windows forms,
however, they can also respond to user events such as mouse clicks.
• The Web application' s executable is stored in a .dll file called an assembly.
Assemblies are compiled to an intermediate state, and the final compilation is
done by the CLR just before running the application.
• The .NET Framework is made up of the CLR and the .NET class library. The
.NET class library makes the CLR run-time tasks available to programmers.
• The .NET classes are grouped by programming task into namespaces. These
groupings help you locate the class, method, or property you need to accomplish a
task.
• Use the Visual Studio .NET Start page to view current product information, to
open new or existing projects, to set user environment preferences, and to sign up
for Web hosting services.
• Edit Web Forms pages and HTML pages visually by using the Document window'
s Design mode; edit them as text by using the Document window' s HTML mode.
• Set the Help language filter to view code samples in a single programming
language or in multiple languages.
• Modify the Visual Studio .NET environment features using the Options dialog
box.

• Web applications use Web forms to create a user interface that is presented
through an Internet browser on the user' s computer.
• The code and resources that respond to events and perform useful tasks reside and
run on the Web server hosting the application.
• Because Web applications are distributed between a client and a server, there are
four significant differences between programming for the Web and programming
for Windows:
o Web applications use server controls and HTML controls rather than
Windows controls.
o Web applications are displayed in a Web browser rather than in their own
window.
o Web forms are not persistent while displayed. You must preserve
persistent data in a state variable during page and control events.
o Processing occurs on the server and data is exchanged through a cycle of
requests and responses.

1 of 8
DotNet Summary

• Web applications are event-driven, and events occur at the application, page, and
server control levels.
• Server control events have three types, which occur in the following order:
o Validation events occur before the page is returned to the server.
o Cached events are collected while the page is displayed, and then
processed once the page sends a request to the server.
o Post-back events cause the page to send a request to the server, but their
event procedure is processed last in order of events handled.
• The boundaries of a Web application are determined by its folder structure.
• Application boundaries affect the scope of data stored in Application state and
they allow you to specify the process in which the server runs your application.
• You use IIS to create root folders for your applications, set application
boundaries, and determine the process in which IIS runs your application.

• Namespaces organize your code and provide access to code in the .NET
Framework. To use a namespace from outside of your project, establish a
reference to it using the References dialog box from the Project menu. Add an
Imports (Visual Basic .NET) or using (Visual C#) statement to the source file to
provide a shortcut for referring to members of the namespace in code.
• Classes define objects within a namespace. You can base one class on another
using inheritance. When using inheritance, the base class provides its members to
the derived class where they can be overridden, overloaded, or hidden.
• Web applications use the System.Web and System.Web.UI namespaces. These
namespaces define most of the objects used in a Web application, including the
Application, Page, Request, and Response objects. These four objects provide
access to most of the subordinate objects in a Web application.
• Because ordinary variables defined in a Web form are not persistent, you need to
save volatile data between requests. ASP.NET lets you save data items as query
strings, cookies, ViewState, Session state, or Application state.

• Server controls provide properties, methods, and events that can be used in server
code.
• HTML controls provide attributes and events that can be used in scripts that run
on the client. To access properties of an HTML control in server code, add a
runat=server attribute to the control' s HTML definition.
• ASP.NET performs control validation on the client side immediately before
posting the Web form back to the server. Once client-side validation succeeds, the
Web form is validated again on the server side before the Page_Load event
occurs. This ensures that the Web form has not been modified on the client to
bypass validation and it also guarantees that validation will work with pre-Internet
Explorer 4.0 browsers.

2 of 8
DotNet Summary

• Use multiple validation controls to check multiple conditions on a single data


field. For instance, a TextBox that requires a telephone number should be
validated by both a RequiredFieldValidator and a RegularExpressionValidator
control.
• To navigate between pages in a Web forms application, use one of the following
techniques. (The two Server object methods work only with Web forms.)
o Hyperlinks
o The Response.Redirect method
o The Server.Transfer method
o The Server.Execute method
o Client script procedures
• To perform an action in the client browser, you must use a client script. For
example, to open a page in a new window, you would use a Button HTML control
with an onclick="window.open()” attribute. This is because client scripts are the
only executable code in a Web forms application that runs on the client.

• ADO.NET includes three key components used for most data access: database
connection, data adapter, and data set.
• To access a database, follow these steps:
o Create a connection to the database.
o Create a data set using an adapter object.
o Use the data set to display data or to change items in the database.
o Update the database from the data set.
o Close the database connection.
• ADO.NET provides typed data sets. Typed data sets use explicit names and data
types that help prevent errors during programming.
• Use data binding to quickly display data sets on Web forms through the DataGrid,
DataList, or other list controls.
• Create command objects to execute SQL commands directly on a database.
Command objects may return a single value (ExecuteScalar), modify the database
(ExecuteNonQuery), or return data (ExecuteReader).
• Transactions group database commands so that they succeed or fail in an all-or-
nothing fashion. This ensures that changes are not partially made, thus preserving
the integrity of the database.
• To determine which commands should be included in a transaction, use the ACID
test. A transaction must be atomic, consistent, isolated, and durable.
• To use a transaction, follow these steps:
o Begin the transaction.
o Perform commands and make changes that are part of the transaction.
o Check for errors.
o If errors occurred, undo (roll back) the changes. If no errors occurred,
commit the changes. This ends the transaction.
• Manage data set transactions using the Update method to commit changes and the
RejectChanges method to undo (or roll back) changes.
• Manage database transactions using the transaction object' s Commit and
Rollback methods.

3 of 8
DotNet Summary

• Exception handling provides a way to deal with unusual occurrences in your


program. Each of the different exception-handling techniques provides a way to
set aside the complexity of dealing with these unusual occurrences so that they do
not obscure the main logic of your application.
• Exception-handling blocks use the Try, Catch, Finally (Visual Basic .NET) or try,
catch, finally (Visual C#) keywords to handle exceptions within a procedure.
• Catch exceptions in order from most the most specific exception type to the most
general exception type.
• Use the Throw (Visual Basic .NET) or throw (Visual C#) keyword to intentionally
cause an exception.
• Error events handle exceptions in a separate event procedure. Use the Server
object' s GetLastError and ClearError to handle exceptions within error events.
• Error pages handle exceptions that occur outside of the Web application because
of Internet-related problems.
• Monitor exceptions that are handled in your application by writing messages to
the trace log using the Trace object' s Write and Warn methods.
• Enable application-level tracing by setting the <trace> element' s attributes in the
Web.config file.
• Enable page-level tracing by setting the Trace attribute in a Web form' s Page
directive.

• Cookies enable you to invisibly save information about a particular user. Cookies
can be used to save the information directly on the user' s computer or indirectly
through a unique identifier, which is then referenced to retrieve user information
from a data set stored on the server.
• Use the Browser object' s Cookies property to test whether a browser accepts
cookies before you attempt to create them.
• Use the Request object' s Cookies collection to retrieve a cookie from the user.
Use the Response object' s Cookies collection to create or modify a cookie on the
user' s computer.
• Set the Cookie object' s Expires property to Now to delete a cookie from the user'
s computer.
• Use the mailto: protocol to create a message that will be sent from the user' s mail
system. The mailto: protocol is used as part of a hyperlink.
• Use the MailMessage and SmtpMail classes to compose and send messages from
the server' s mail system.
• Frames allow you to display multiple pages in a single browser window. The
display and scrolling of each frame is controlled independently.
• Use the Browser object' s Frames property to test whether a browser supports
frames before displaying them.
• Hyperlinks on one frame can display a page in another frame by using the target
attribute. You can control frames only from hyperlinks or client-side scripts.
• Client-side scripts let you control the browser window, respond immediately to
non-post-back events, and perform other tasks that are not possible from server-
side code.

4 of 8
DotNet Summary

• Use the Browser object' s VBScript or JavaScript properties to test if the browser
can run scripts. Use an inline test script that redirects the users to another page to
test whether a user has disabled scripting through his or her browser security
settings.
• Add script event procedures to a page' s HTML to respond to events that occur on
the client side rather than the server side.

• Authentication is the process of identifying users. Authorization is the process of


granting access to those users.
• The default method of access to a Web application is anonymous access.
Anonymous users are granted access through the Windows IUSER_machinename
user account.
• ASP.NET provides three different authentication modes through the
System.Web.Security namespace: Windows, Forms, and Passport.
• HTML pages aren' t automatically included under ASP.NET authentication. To
ensure that users are authenticated before they can view those types of files, use
IIS to map the .htm and .html file extensions to the ASP.NET executable.
• To require authentication, add a <deny users=“?”> element in the authorization
section of Web.config. This applies to all three authentication modes.
• Use the <authorization> element to allow or deny access to users under Windows
authentication.
• Use the <credentials> element or an external users database to allow users under
Forms authentication.
• Changing the Web.config file restarts the Web application, so it is not a good idea
to add users to the Web.config <credentials> element at run time. Instead, use an
external file or database to store user names and passwords.
• Install the Passport SDK to enable the Passport classes in the
System.Web.Security namespace.
• To enable secure, encrypted communication over the Internet, install a server
certificate and use the https protocol.

• Set the build option to Release and debug attribute to “false” in Web.config before
building your application for deployment.
• Use the AssemblyInfo.vb or AssemblyInfo.cs file to identify the application' s
assembly and provide versioning information.
• To deploy a Web application, use the Visual Studio .NET upload tools or simply
copy the application' s assembly and content files to the server.
• Set the security privileges on the ASPNET user account to enable your Web
application to write files or access other security-restricted resources on the
server.
• After deployment, monitor the Web application using the MMC Event Viewer and
Performance Logs and Alerts snap-ins.
• You can repair Web applications by uploading new versions of the application' s
assembly or content files to the server.
• Web applications with memory leaks or other problems can repair themselves
through ASP.NET process recycling.

5 of 8
DotNet Summary

• Use the FrontPage Server Extensions to improve Web application performance by


caching frequently used pages.
• To enable a Web garden, use the processModel element attributes in the server' s
Machine.config file.
• To enable a Web farm, use a load balancer to distribute requests to multiple
servers.
• For both Web gardens and Web farms, share Session state information by setting
the sessionState element in the application' s Web.config file.

• Testing measures conformance to product requirements.


• Unit tests check that each piece of code works correctly.
• Integration tests verify that all components work together.
• Regression tests make sure that new code does not break existing code.
• Load tests check that the product works under extreme usage.
• Platform tests make sure that a Web application displays correctly and has
reasonable performance using different browser and network connection -
configurations.
• Use ACT to record user interaction with a Web application in VBScript, then
replay that script to simulate multiple users and log application errors and server
performance.
• To test a .NET assembly with the Windows Scripting Host, register the assembly
for use with COM, and then copy the scripting host (CScript.exe) to the assembly'
s folder.
• To run attended builds and tests, create a command file containing the build
commands to execute and test scripts to run, and then schedule the command file
to run using the Windows Task Scheduler.
• Use the Debug and Trace diagnostic classes to display alerts and log error
conditions during the development process.
• By default, code written with the Debug class is stripped out of release builds,
while code using the Trace class is left in.
• Visual Studio .NET can attach to the process of a Web application running on a
remote server to debug that application in a real-world setting.

• Create user controls by drawing server and HTML controls on a user control page
(.ascx).
• Add a user control to a Web form by dragging the control from the Solution
Explorer, rather than from the Toolbox.
• User controls must be part of the project where they are used and are initialized
after their containing Web form' s Page_Load event.
• Create composite custom controls by defining a class derived from the
WebControl base class.
• Composite controls are made up of server and HTML controls added through the
CreateChildControls method.
• To add features to an existing server control, superclass that control by deriving a
new custom control from the existing control' s class.

6 of 8
DotNet Summary

• Rendered custom controls provide more control over the appearance and behavior
of the control, but require more programming to handle the tasks that composite
custom controls usually handle through their child controls.
• Use the Render method and the HtmlTextWriter utility methods to create the
appearance of a rendered custom control.
• Use the IPostBackEventHandler interface to enable a rendered control to trigger
post-back events.
• Use the IPostBackDataHandler interface to enable a rendered control to get data
that the user enters in a control at run time.

• Create user controls by drawing server and HTML controls on a user control page
(.ascx).
• Add a user control to a Web form by dragging the control from the Solution
Explorer, rather than from the Toolbox.
• User controls must be part of the project where they are used and are initialized
after their containing Web form' s Page_Load event.
• Create composite custom controls by defining a class derived from the
WebControl base class.
• Composite controls are made up of server and HTML controls added through the
CreateChildControls method.
• To add features to an existing server control, superclass that control by deriving a
new custom control from the existing control' s class.
• Rendered custom controls provide more control over the appearance and behavior
of the control, but require more programming to handle the tasks that composite
custom controls usually handle through their child controls.
• Use the Render method and the HtmlTextWriter utility methods to create the
appearance of a rendered custom control.
• Use the IPostBackEventHandler interface to enable a rendered control to trigger
post-back events.
• Use the IPostBackDataHandler interface to enable a rendered control to get data
that the user enters in a control at run time.

• Styles follow this order of precedence based on where they are applied: local
(applied on an element), page (applied within a page' s head element), and global
(applied through a style sheet).
• Use the link element within a Web form' s head element to attach a style sheet.
• Use the Visual Studio .NET Style Builder Wizard to modify existing styles.
• Use the Visual Studio .NET Add Style Rule Wizard to create a new style.
• Create a style class to apply the same formatting to different types of elements.
• Use the CssStyle attribute to apply a style class to a server control. Use the class
attribute to apply a style class to an HTML element.
• XSL transformations convert XML input files into HTML through the XML
server control.
• XML organizes data into a hierarchical set of nodes.
• XSL templates apply formatting to nodes within an XML file.
• Use the xsl:value-of element to retrieve data from an XML node.

7 of 8
DotNet Summary

• Use the xsl:text element to include literal text and white-space characters in XSL
output.
• Use the xsl:for-each element to repeat tasks for lists, tables, and other repeated
nodes within an XML file.
• Use the xsl:if, xsl:choose, xsl:when, and xsl:otherwise elements to perform
conditional processing within XSL.

• You can provide user assistance within Web applications by using ToolTips, Web
forms or HTML pages, or HTML Help.
• HTML Help provides built-in Contents, Index, and Search capabilities.
• Use the window object' s showHelp method in client-side scripts to display the
HTML Help Viewer.
• Use the HTML Help Workshop to create HTML Help projects and to compile
HTML Help.
• Use the HTML Help ActiveX object to add index keywords, related topic links,
and associative links to Help topics.
• To display compiled Help files from a Web application, you must first download
the file to the user' s machine.

• Use the Request object' s UserLanguages array to detect the user' s culture.
• Set the culture and uiCulture attributes of the globalization element in Web.config
to create culture-specific Web applications.
• The .NET Framework identifies cultures using the language and region codes
listed in the CultureInfo class' s online Help topic.
• Set the culture used by the application for formatting dates, currencies, numbers,
and determining sort order using the Thread class' s CurrentCulture property.
• Use the Thread class' s CurrentUICulture to determine which satellite assembly is
used to load localized resources.
• Add id and runat attributes to HTML elements to be able to display localized
strings from resource files in those elements at run time.
• Elements within a resource file are case sensitive and must be uniquely named
within the scope of the application, so use a naming convention such as
webform.id.
• When creating Web forms that use non-ASCII characters, save the file using the
UTF-8 encoding with a signature. Including the signature allows ASP.NET to
automatically detect the file' s encoding.

8 of 8

Vous aimerez peut-être aussi