Wednesday, March 24, 2010

.NET 4 ASP.NET MVC 2 70-515 Catto Code Cracking Post #7

.NET 4 ASP.NET MVC 2 70-515 Exam Prep Catto Code Crackin Post #7

Developing a Web Application by Using ASP.NET MVC 2 (13%)

In this 7th post of the Catto Code Crackin series we’ll continue with the section ‘Developing a Web Application by using ASP.NET MVC 2 . In the .NET 3.5 exam there wasn’t a MVC sections. In the .NET 4 exam the section iis listed as 13%.

Microsoft announced the .NET 4.0 Beta Exams on St. Patrick’s Day which are a free exam & if passed you get certified. Much of the study & prep materials are not available yet, therefore I’ve been studying for a similar exam 70-562 which is the .NET 3.5 ASP.NET Application Development. I hope by posting this content it will help myself along with other people in the community learn & get excited about .NET 4. If you are serious about studying for a MS Exam 2 must have resources: the Self Paced training books are a great books to buy along with practice exams from eBay.

Let’s Start with the Official Skills Measured:

Developing a Web Application by Using ASP.NET MVC 2 (13%)

ASP.NET MVC 2 is an additional framework that is installed on top of .NET 3.5 SP1. Once it’s installed in visual studio we can create a new project of type MVC.

Lets look @ the frameworks installed:

In the book there is no MVC. Let’s go get some content that are important points

Lets first go to dub dub dub dot a s p . net / mvc www.asp.net/mvc. This is the best place that I enjoy to goto first. I liked to hear MVC is similar to classic asp since I’ve spent quite a bit of time with classic asp 3.0. There are no server controls only html helpers so therefore there isn’t as much hidden & more flexibility, There are some fundamentals too. Da Gu’s MVC Posts!

Let’s be clear the skills measured is MVC2. There are some great items we can learn about the enhancements of the second Let’s hit this after an overview & file structure example.

MVC – Model View Controler http://www.asp.net/mvc/whatisaspmvc/

There is a great forum question on SO

The best answer from Mr. Flowers

MVC borrows good thinigs from Rails, AJAX hiding js could hurt us, JQuery has taken over the world it’s Open Source.

Here are other content public from some skills people. Stephen Walther has a stellar blog with many tips on MVC he also does many of the vids on the official ms site. Jeffery Palermo has some good MVC content too Here is a great post by Hanselminutes.

PodCasts!\Some great pods in order of quality with best quality @ top in my opinion:

DNR ASP.NET MVC 2 - Show 533 w/ Phil Haack

Hanselminutes ASP.NET MVC 2 - #206 w/ Phil Haack

Deep Fried Bytes ASP.NET MVC ‘in action’ – #48 Jeffery Palermo, Ben Scheirman, & Jimmy Bogard

Polymorphic Pod ASP.NET MVC Jeffery Palermo

Code Example - Nerd Dinner on CodePlex is a great code example: http://nerddinner.codeplex.com/

MVC file structure differs from web forms, Let’s take a look at some:

Model - Core info Classes. The model folder tree could be an example here:

Models
Event.cs
EventRepository.cs
IEventRepository.cs
GeekEvent.dbml
GeekEvent.dbml.layout”
GeekEvent.dbml.cs
RuleViolation.cs

Views - presentation HTML Markup. Views are a folder here is an example of a folder tree of the views folder:
Views
Account
LogOn.aspx
Resiger.aspx
Event
Create.aspx
Details.asp
Home
About..aspx

Controller control flow logic. Interacts with model & view. An example of the Controller folder explorer tree would be:

Controller
AccountController.cs
EventController.cs
HomeConttroller.cs
SearchController.cs

Controllers == app flow control logic

View == html page, scripts

Model === application logic such as all business logic, validation, data access layer

The first skilled measured is Create Custom Routes:

Let’s look @ this library page on ASP.NET Routing

A route is a URL pattern that is mapped to a handler. 
{controller}.mvc/{action}/{id}

Adding constraints to routes is first on the list of skills measured here is a nice link to the library. It states: we can specify that values in the parameters meet certain constraints. We can add constants to ensure that the URL parameters contain values that will work in your app.

X 7 2 Create controllers & actions

Create controller by right click on the controller folder, select add controller. Ensure that the name of the controller ends in controller example EventController or Default1Controller

Adding Actions to a controller You add actions by adding a new method to the controller. Here are some requirements of actions:


· The method must be public.

· The method cannot be a static method.

· The method cannot be an extension method.

· The method cannot be a constructor, getter, or setter.

· The method cannot have open generic types.

· The method is not a method of the controller base class.
· The method cannot contain ref or out parameters.

Action filters There are many types of action filters in MVC such as
Authorization Filters – security decision whether to execute action filter

Action Filter – wraps action method execution. This filter can perform additional processing, such as providing extra data to the action method, inspecting the return value, or canceling execution of the action method.

Result Filter & Exception Filter.

There is a project on codeplex ASP.NET MVC Action Filters this projects states it has the following planned Action Filters
· Action filter for creating easy REST API with JSON and XML
· Action filter for logging scenarios
· Action filter for microsoft health monitoring
· Action filter for client caching
· Action filter for client compression
· Action filter for server caching
· Action filter for controller execution time measurement

It builds on the nerd Dinner example. There is a folder in the directory Mvc.ActionFilters with some files in it such as AutoRefreshAttribute.cs, ClientSideCashe.cs. It may be worth taking a look at too.

X 7 3 4 Structure of ASP.NET MVC app

Content Files & Folders
URLs map to files such as an .aspx file
ASP.NET MVC maps differently from ASP.NET web forms. Web forms mapst to pages or handlers, MVC maps URL’s to controller classes such as AccountController.cs

ASP.NET MVC 2

Great resource is the What inside MVC a pdf
New Features of MVC 2 are: MVC2 buils on MVC 1.0 & enhances features therefore it’s compatible with ASP.NET MVC 1.0 all skills continue to apply.
MVC 2 provides us Strongly Types Helpers

helpers (ex. MVC 1.0 <% html.TextBox(“ProductName”, Model.ProductName) %>

MVC 2 <% Htlm.TextBoxFor(model => model.ProductName) %>


This gives us intellisese to since strongly typed which is good.

Areas

MVC 2 provides us more support. Examples for support:

Asynchronous Contorllers - support that enables long running tasks in parallel

Binding Binary Data with Model Binders

DataAnnotations Attriubues

DefaultValueAttribute in Action Method params

MVC 2 - Client Side Validation
MVC 2 - VS 2010 code snippets

MVC2 has some cashing features right? No MVC2 doesn’t really have any new cashing features.

Some more content about ASP.NET MVC:
Download Rrameowrks:
ASP.NET MVC 1.0

ASP.NET MVC RC 2

ASP.NET MVC Forum

MVC 3

Road map for mvc 3 productivity, AJAX, architecture & performance

CAPTCHA
AJAX Helpers
MEF for actitecutre & App Scaffolding
Performance Improved Cashing Support

--------------------------------------------------------

Code:

Here are some good code examples http://code.msdn.microsoft.com/aspnetmvcsamples s

In the web.config let’s check out this code from nerddinner: Let’s display it both collapse just a two sections of the system.web & expanded:

<system.web>

<httpHandlers> … </httpHandlers>

<httpModules>…<httpModules>

</system.web>

<httpHandlers>

<remove verb="*" path="*.asmx" />

<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />

<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

</httpHandlers>

<httpModules>

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

</httpModules>

</system.web>

Let’s look a a drastically different default.aspx page than we ar eused to

Here is the default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="NerdDinner._Default" %>

<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%>

& default.cs

using System.Web;
using System.Web.Mvc;
using System.Web.UI;
namespace NerdDinner {

public
partial class _Default : Page {

public void Page_Load(object sender, System.EventArgs e) {

HttpContext.Current.RewritePath(Request.ApplicationPath, false);

IHttpHandler httpHandler = new MvcHttpHandler();

httpHandler.ProcessRequest(HttpContext.Current);

}


}

}

X 7 3 4 Content Files & Folders
Let’s check out the msdn library & here is
Global URL Routing Defaults:



Routes are initialized in the Application_Start method of the Global.asax file. The following example shows a typical Global.asax file that includes default routing logic.

public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
7 4 5 How bout ViewMasterPage (TModel Class ) Crackin code ViewMasterPage is an item on the official skills measured.
.NET Framework Class Library
ViewMasterPage<(Of <(TModel>)>) Class
Represents the information that is required in order to build a strongly typed master view page
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Public Class ViewMasterPage(Of TModel) _
Inherits ViewMasterPage
public class ViewMasterPage<TModel> : ViewMasterPage

7 4 6 This is the last skill measured FYI

ViewUserControl(TModel) Class

Public Class ViewUserControl(Of TModel) _
    Inherits ViewUserControl
public class ViewUserControl<TModel> : ViewUserControl

Represents the information that is required in order to build a strongly typed user control.

Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)

7 4 1 b http://msdn.microsoft.com/en-us/library/dd410596%28VS.100%29.aspx

Begin Form Helper example course theres more like listbox, dropdownlist, textbox ect.

<% using(Html.BeginForm("HandleForm", "Home")) %>
<% { %>
    <!-- Form content goes here -->
<% } %>
<% Html.BeginForm(); %>
    <!-- Form content goes here -->
<% Html.EndForm(); %>
Debugging Code 
       Example such as NerdDinner my first MVC Error is a classic familiar ASP.NET yellow screen of death. Debugging is so fun. Here is an example of a MVC Parser Error nice & familiar.

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.


Parser Error Message: Could not load type 'NerdDinner.MvcApplication'.
Source Error:

Source File: /global.asax Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Automapper is a third party tool I don’t know about would this be part of MVC 3

We now have covered over much of ASP.NET MVC 2 & some of the skills that will be covered on the exam. Let’s review more code & watch some more videos & do it all over again to get a better understanding, maybe create some sample exam questions. What is the future?

Also this is very interesting & similar: crackin code is fun

MVVM – Model View View Model (not on exam)

---------------------------------------------------------------------------

That’s all there will be more,

Catto

Monday, March 22, 2010

.NET 4 Data & Services 70-515 Exam Prep ASP.NET – Catto Code Crackin #5

.NET 4 Data & Services 70-515 Exam Prep ASP.NET – Catto Code Crackin #5

Hey Now Everybody,

In this 5th post of the Catto Code Crackin series we’ll continue with the section ‘Working with Data & Services’. In the .NET 3.5 exam ‘Working with Data & Services’ are ~17%. In the .NET 4 exam the section is listed as ‘Displaying & Manipulating Data’ is listed as 19%. Data to me is very fun to work with. It’s one topic that where I’m very interested in learning new data access layers & spending time developing with data driven sites.

Microsoft announced the .NET 4.0 Beta Exams on St. Patrick’s Day which are a free exam & if passed you get certified. Much of the study & prep materials are not available yet, therefore I’ve been studying for a similar exam 70-562 which is the .NET 3.5 ASP.NET Application Development. I hope by posting this content it will help myself along with other people in the community learn & get excited about .NET 4. If you are serious about studying for a MS Exam 2 must have resources: the Self Paced training books are a great books to buy along with practice exams from eBay.

Let’s start with taking a look at the official skills measured from MS.

Displaying and Manipulating Data (19%)

· Implement data-bound controls.
This objective may include but is not limited to:
advanced customization of DataList
Repeater,
ListView,
FormsView,
DetailsView,
TreeView,
DataPager,
Chart,
GridView
This objective does not include:
working in Design mode

· Implement DataSource controls.
This objective may include but is not limited to:
ObjectDataSource,
LinqDataSource,
XmlDataSource,
SqlDataSource,
QueryExtender,
EntityDataSource
This objective does not include:
AccessDataSource,
SiteMapDataSource

· Query and manipulate data by using LINQ.
This objective may include but is not limited to:
transforming data by using LINQ to create XML or JSON,
LINQ to SQL,
LINQ to Entities,
LINQ to objects,
managing DataContext lifetime
This objective does not include:
basic LINQ to SQL

· Create and consume a data service.
This objective may include but is not limited to:
WCF,
Web service;
server to server calls;
JSON serialization,
XML serialization
This objective does not include:
client side,
ADO.NET Data Services

· Create and configure a Dynamic Data project.
This objective may include but is not limited to:
dynamic data controls,
custom field templates;
connecting to DataContext and ObjectContext

Now that we’ve reviewed the skills measured on the .NET 4 exam data section let’s go to the .NET 3.5 book & review a three chapters key points:

· When working with disconnected data, a DataTable object is always required.

· The DataTable object contains DataColumn objects, which define the schema & DataRow objects, which contain the data. DataRow objects have RowState & DataRowVersion properties

· You use the RowState property to indicate whether the DataRow should be inserted, updated, or deleted from the data store when the data is persisted to a database.

· The DataRow object can contain up to three copies of its data, based on the DataRowVersion. This feature allows the data to be rolledback to its original state, & you can use it when you write code to handle conflict resolution.

· The DataSet object is an in memory relational data representation. The DataSet object contains a collection of DataTable objects and a collection of DataRelation objects.

· DataSet & DataTable objects can be serialized & deserialized to and from a binary or XML file or stream. Data from other DataSet, DataTable, & DataRow objects can be merged into DataSet object.

· LINQ to DataSet provides a mechanism for writing complex queries against in memory data using C# or VB.

· Connected classes, also known as provider classes, are responsible for movement of data between the data store & the disconnected classes. A valid DbConnection object is required to use most of the primary provider classes.

· You use the DbCommand object to send a SQL command to a data store. You can also create parameters & pass them to the DbCommand object.

· The DbDataReader object provides a high-performance method of retrieving data from a dta store by delivering a forward only, read only, server-side

· The SQLBulkCopy object can be used to copy data from a number of source to a SQL Server table.

· You can use the DbDataAdapter object to retrieve & update data between a DataTable and a data store. The DbDataAdapter can contain a single SelectCommand for read-only data, or it can contain a SelectCommand,for InsertCommand, UpdateCommand And DeleteCommand for fully updatable data.

· The DbProviderFactory object helps you create provider-independent code, which might be necessary when the data store needs to be quickly changeable

· Use the Using statement to ensure that the Dispose method is called on the connection and command objects to avoidconnection leaks

· You can use the DbProviderFactories object to obtain a list of the provider factories that are available on a computer.

· You can work with BLOBs using the same techniques you use for smaller data type unless the objects are too large to fit into memory. When a BLOB is too large to fit into memory. You must use streaming techniques to move the data.

· You can use LINQ to SQL to create an O/R map of you databse. Programming against an automatically generated O/R map makes database programming faster & easier by providing design-time type checking & IntelliSense against you data tables and their columns.

· XML Documents can be access by using the DOM

· The XPathNavigator uses a cursor model & XPath queries to provide read only random access to the data

· The XmlReader provides an object for validating against DTD, XDR or XSD by setting the XmlReaderSettings object properties

· LINQ to XML uses the XElement class to load XML data, write LINQ queries against it and write the data back if need be. You can also functionally define XML in your code using LINQ to XML.

· ASP.NET provides a number of data source controls that allow you to easily work with various types of data. This includes binding to data using data-bound Web server controls.

· You can pass parameters to most data source controls. A parameter can be bound to a value in a cookie, the session, a form field, the query string or similar object.

· You can cache data using many of the data source controls. This includes the Object DataSource, SQLDataSource & AccessDataSource controls.

· Simple data bound controls consist of controls that inherit from the ListControl such as DropDownList, ListBox, CheckBoxList, BulletedList, & RadioButtonlIst. For these controls, you set the DataTextField to the name of the column that contains the data you wish to display to the user. You set the DataValueField to the column that contains the values you wish to return to the server for a selected item.

· Composite data bound consist of the GridView, DetailsView FormView, Repeater, ListView & DataList controls. The GridView & DetailsView controls show data as tables. The other controls allow you to define templates for laying out your data. The gridview is personally the data control that I use the most.

· Hierarchical data bound controls consists of the Menu & TreeView controls. These controls are used for displaying data that contains parent child relationships.

· You can create an XML Web service in ASP.NET by defining an .asmx file. You use the attribute class WebServiceAttribute class WebServiceAttribute to mark a class as a Web Service. You use the WebMethod attribute class to define the methods on that class that should be exposed as web services. You can also inherit from WebService if you intend to use the features of ASP.NET inside your service.

· You secure a Web service in ASP.NET as you would any other ASP.NET resource. You can also define custom Web service security through custom SOAP headers.

· You call a Web service from the client using ASP.ENT AJAX extensions. You use the scriptmanager cals to reference a Web service that is in the same domain as the given web page. A Javascriipt client proxy is then generated for you. You an use this proxy to call your web service. ASP.NET AJAX does the rest.

· You can consume a XML web service in an ASP.NET web site by setting a Web reference to it. This generates the proxy class.

· WCF is a unifying programming model for creating service orientated apps. With WCF you can create services that work with HTTP, TCP, MSMQ & named pipes

· You write WCF service by first defining a contract typically as an interface. The contract uses the attribute classes ServiceControl and OperationContract to define the service and its method.

· ASP.NET & IIS allow you to host WCF services that you wish to expose as HTTP. You can use this model to write services that take advantage of ASP.NET features such as session state & Security.

Need Chapter 8 & 9

Here are some key points from some sample exams:

1 The DataTextField is used to display text to the user.

The DataValueField is used to return values for selected items.

2 TypeName is used to indicate the name of the class you intend to use for your object-based data source control.

SelectMethod is used to indicate a method on your object used for selecting data.

3 The InfoMessage event displays informational messages as well as the output of the SQL Print statement.

4 The GridView control allows for the display of multiple rows of data and allows users to update that data.

The ListView implicitly supports displaying data in a list and updating that data.

5 The LinqDataSource can be used to connect to a context map defined for your database.

6 Setting the key Asynchronous Processing =true for the connection string will allow you to access data asynchronously.

7 The CacheDuration attribute defines for how long the data of the control should be cached.

The EnableCaching attribute is used to turn on caching for the given data source control.

8 Use the XmlDocument class to create a new XML document from scratch.

9 A WCF Service application is an ASP.NET Web site that is set up to define and expose WCF services.

10 Client certificates can be secured and verified by a third party.

11 The Close method of the DbConnection class will clean up the connection.

The Using block ensures the Dispose method is called (which cleans up connections).

12 The Parse method parses a string into an XElement.

To write your query, you define an IEnumerable<XElement> variable.

13 The DataContract attribute class indicates your class can be serialized with WCF.

The DataMember attribute indicates public members that should be serialized as part of the DataContract.

14 The XmlConvert class is used for data conversions between XML and .NET Framework data types.

15 The DataView can be used for each sort.

16 The WebService class is a base class that will allow your Web service to have access to session state and more.

17 You can use the DataRelation object to navigate from a child to the parent or from the parent to a child.

18 You need to generate an O/R map to use LINQ to SQL. You can do so with SqlMetal. You can also use the O/R designer or hand-code your map.

You must reference the System.Data.Linq namespace to use the features of LINQ to SQL.

The DataContext object is the connection between your O/R map and the actual database.

19 Primary keys must be defined or the changed data will be appended into the destination DataSet instead of being merged.

20 The AsEnumerable method of the DataTable is used to define a LINQ query.

The Where clause can be set to select only those vendors that are active.

The Order By clause will sort the vendors by a given field.

21 The DropDownList control can display a list that uses a minimum amount of space.

22 Setting the IsOneWay parameter to true indicates that the operation does not return a response

23 The Add Web Reference dialog box will find the Web service and its description and generate a proxy for use by your Web site.

The proxy class will provide access to the Web service.

24 Get 32 more questions

In this second section we’ll use the number 2.1, 2.2 & we’ll continue with some key points from a practice exam:

2.1  You add a reference to a WCF service that is deployed on the app server by in Solution explorer right click you project & select add service reference.

2.2 On a WCF service deployed on an app server has a reference added. The net admin reconfigs the WCF service to use TCP. Locate the configuration in the <system.servicesModel> section of the apps web.config file to modify the binding in the <bindings> section. Since the service binding on the server was adjusted we must reconfigure the client binding in the <bindings> section of the config.

2.3 Executing a proc & display the value returned in a textbox. We use parameterized SQL Queries to retrieve and return value from stored procs:

cmd.Parameters.Add(new

SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4,

ParameterDirection.ReturnValue, false, ((System.Byte)(10)),

((System.Byte)(0)), "", System.Data.DataRowVersion.Current,

null));

cmd.ExecuteNonQuery();

ResultsTextBox.Text =

(int)cmd.Parameters["@RETURN_VALUE"].Value.ToString();

2.4. Configure a data source control to access the Contacts collection:

<asp:LinqDataSource

ContextTypeName="AdventureWorksDataContext"

TableName="Contacts"

ID="DataSource1"

runat="server">

</asp:LinqDataSource>

Use the LinqDataSource to access a LINQ query. Set the ContextTypeName to the DataContext class and set the TableName to the name of the property that gives the collection of objects returned by a query.

2.5 A XML Web Service with a reference is redeployed to a prod server. To ensure your app can be updated to use the prod server URL w/out recompiling code you can set the URL property of the web service proxy using a value read from configuration.

2. 6 Code to execute an asynchronous query.

SqlConnection conn = new SqlConnection(connectionString);

SqlCommand db = new SqlCommand("SELECT ID, Contact FROM Vendors", conn);

conn.Open();

AsyncCallback callback = new AsyncCallback(DisplayResults);

db.BeginExecuteReader(callback, db);

To create a connection string that will allow the query to execute ensure the string includes

Async = ture

The SqlCommand.BeginExecuteReader starts an asynchronous database query. To use asynchronous queries, you must have Async=true in the connection string. In addition, the callback method must accept an IAsyncResult object as a parameter.

2. 7  A reference is added to a WCF service deplaoyed on an app server. To identify the location of the service contract schema to debug an issue identify the location of the application’s App_WebReferences folder

The App_WebReferences folder contains files used to create a reference to a WCF service (in the same project or external to the project), including schema files that detail the contract.

2.8  An ASP.NET web app must access a class with the fully qualified name Contoso.Financial.MarketDataSet that implements the following interface.

interface IMarketDataSet

{

DateTime BeginDateTime {get;}

DateTime EndDateTime {get;}

string Security {get;}

ICollection<MarketData> Prices { get; }

}

The configuration  to configure an ObjectDataSource control to expose the Prices collection is:

<asp:ObjectDataSource  ID="DataSource1"  runat="server" TypeName="Contoso.Financial.MarketDataSet" SelectMethod="Prices" />

Set TypeName to the type of the data source.
Set the SelectMethod to the type that returns the collection to which to bind.

2.9  An ASP.NET web page calls an XML web service that requires callers to authenticat with Windows credentials. Set the UseDefaultCredentials property of the Web service proxy to True when you provide the credentials that represent the user name, the password, and the domain of the process executing your Web application and using security best practices.

To supply the credentials of the current process, set the UseDefaultCredentials property of the Web service proxy to True, and set the Credentials property of the Web service proxy to the CredentialCache.DefaultCredentials property. This provides the users' credentials to the Web service.

2.10 A TableAdapter is a type class that provides communication between your application and a database. More specifically, a TableAdapter connects to a database, executes queries or stored procedures, and either returns a new data table populated with the returned data or fills an existing DataTable with the returned data. TableAdapters are also used to send updated data from your application back to the database. A TableAdapter is similar to a DataAdapter except that a TableAdapter can contain multiple queries. Each query added to a typed TableAdapter is exposed as a public method that is simply called like any other method or function on an object.

2.11 For straightforward transforms to HTML, use the Xml server control. Set the DocumentSource property to the XML file and set the TransformSource to the XSL file.

2.12    Set DataSource when you are linking a data-bound control to an object that implements the IEnumerable interface, such as Array, ArrayList, Hashtable, or when you are linking to a DataSet object.

2.13  A page is added to our web app that calls an XML Web service. The following code segment shows the invocation of the Web service using the StockProxy proxy class.

StockProxy proxy = new StockProxy();

Proxy.Credentials = CredentialCache.DefaultCredentials;

Int result = proxy.GetPortfolioValue();

After deplying the page the performance degrades. To improve performance call the Web service by using the proxy's asynchronous method in a PreRequestHandlerExecute event handler. Calling the Web service by using the proxy's asynchronous method in a PreRequestHandlerExecute event handler will solve the problem. The page code can access results from the preprocessing.

2.14 An ASP.NET Web app needs to:

* Expose data contained in a .CSV.

* Allow other controls to use data binding to display data exposed by this control.

We can create control that extends the DataSourceControl class. Create a custom data source by extending the DataSourceControl class to allow other users to access the data by using data binding

2. 15 An ASP.NET Web page that validates and processes uploaded XML files. XML that adheres to your schema:

<subscribers>

<subscriber class="primary" phone="555-555-1212">

<pcp id="2432" />

<name firstName = "Guido" lastName = "Pica"/>

<address street="1 elm way" city="Watertown" state="MA" zip="01322" />

</subscriber>

<subscriber class="primary" phone="555-555-1211">

<pcp id="2432" />

<name firstName = "Tanja" lastName = "Plate"/>

<address street="12 Oak Rd." city="Pondville" state="MA" zip="01311" />

</subscriber>  <subscriber class="primary" phone="555-555-1222">

<pcp id="2432" />

<name firstName = "Armando" lastName = "Pinto"/>

<address street="10 Pine St." city="Riverland" state="MA" zip="01321" />

</subscriber>

<subscriber class="primary" phone="555-555-1211">

<pcp id="2432" />

<name firstName = "Jeff" lastName = "Price"/>

<address street="1 Oak Rd." city="Pondville" state="MA" zip="01311" />

</subscriber>

</subscribers>

You load the XML file into an XmlDocument object named doc. You need to add code to create a list of subscribers in Zip code 01311 and display the list in the ListBox control named namesListBox. The following is what you could use:

XmlNodeList xnl = doc.SelectNodes("subscribers/subscriber/address[@zip = '01311']");

foreach (XmlNode xn in xnl)

{

string firstName = xn.ParentNode.SelectSingleNode("name").Attributes["firstName"].Value;

string lastName = xn.ParentNode.SelectSingleNode("name").Attributes["lastName"].Value;

string fullName = firstName + " " + lastName;

namesListBox.Items.Add(fullName);

}

The code samples have differences in the XPath parameter passed to the XmlDocument.SelectNodes method. Given the sample document, identifying the correct nodes requires an XPath of subscribers/subscriber/address[@zip = '01311']. Attributes such as Zip code must always be prefaced with an @ symbol. To identify child nodes, you must list every node in the path, including the top-level node.

2.16 A Web page will access a database. You need to choose a SqlCommand method to execute the following query with the least overhead.

SELECT COUNT(*) FROM CUSTOMERS

Use ExecuteScalar when you need the first row of results returned.

2.17 Given:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

SelectCommand="SELECT [au_id], [au_lname], [au_fname], [phone],

[address], [city], [state], [zip] FROM [authors]"

ConnectionString="<%$ ConnectionStrings:Pubs %>" />

Add a GridView control to display columns labeled First Name, Last Name and Phone #. These columns should contain the table's au_fname, au_lname, and phone column values.

<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1"

AutoGenerateColumns="False"

runat="server">

<Columns>

<asp:BoundField HeaderText="First Name" DataField="au_fname" />

<asp:BoundField HeaderText="Last Name" DataField="au_lname" />

<asp:BoundField HeaderText="Phone #" DataField="phone" />

</Columns>

</asp:GridView>

This was a good example.

2.18 A Web page that will access a database. You need to choose a SqlCommand method to execute a statement that performs database optimizations without returning results.

ExecuteNonQuery is the best method for running SQL commands that do not return results.

2.19 An ASP.NET Web page that will load a large XML document and use XPath to search and filter XML data. An in-memory representation that will provide the best performance and support document editing is XmlDocument.

You can read an XML document using either XPathDocument or XmlDocument (both in the XPath namespace).XPathDocument provides better performance but does not support editing.

2.20 An application that creates XML documents ensuring that the document includes a namespace declaration and all elements are prefix qualified create an XmlNamespaceManager associated with the XmlDocument. Add the namespaces to the XmlNamespaceManager. Reference the related namespace when adding elements.

XmlNamespaceManager is a class that is designed to resolve, add, and remove namespaces from a collection and provide namespace scope management for the namespaces. You can create an XmlNamespaceManager class whenever you want to hold namespaces in a collection, and the collection associates the namespace prefix and their URLs. Create an XmlNamespaceManager associated with the XmlDocument and add namespaces to it. Reference the namespaces in the XmlElements that you add.

2.21 An ASP.NET Web application must access an XML data file defined by a complex schema. Choose a data source control and configure it to expose the XML data modified to a simplified schema.

The correct procedure is to do the following.

* Add an XmlDataSource.

* Set the DataFile attribute to the name of the XML data file.

* Define an XSL file to transform the XML and set the Transform attribute to the name of the XSL file.

2.22 The App_WebReferences folder contains files used to create a reference to a Web service (in the same project or external to the project), including .disco and .wsdl files.

2.23 Use the TableAdapter object to add rows, delete rows, or update rows in a database.

2.24

SqlCommand db = new SqlCommand(

"SELECT ID, Contact FROM Vendors", conn);

conn.Open();

SqlDataReader rdr = db.ExecuteReader();

while (rdr.Read())

vendors.Items.Add(rdr.GetString(0).Trim() +

", " + rdr.GetString(1));

When dynamically creating queries, it is more reliable to name the columns you want to retrieve than to use the * SQL operator. Although * will retrieve all columns, you need to access individual columns by naming the column number. If the table later changes structure because a column is added or removed, the results returned by column number will change, causing unpredictable results in your application. However, if you name the columns in the query, you will always have control over which columns are associated with which column numbers.

2.25    A data-driven ASP.NET Web app configuring a SqlDataSource control to meet the following requirements.

* If a cached item is not accessed for five minutes it is removed.

* The most frequently used items should remain cached in memory longer.

<asp:SqlDataSource

ID="SqlDataSource1"

EnableCaching="true"

CacheExpirationPolicy="Sliding"

CacheDuration="300"

ConnectionString="Server=localhost;database=Items"

SelectCommand="SELECT * FROM Products"

Runat="server" />

To keep frequently accessed items in memory longer, enable a sliding expiration policy by setting theCacheExpirationPolicy attribute to Sliding. When this attribute is enabled, the expiration timer for each item is reset when the item is accessed. Therefore, items that are not accessed will be removed from the cache when the timer expires, but the timer will continue to be renewed for frequently accessed items.

2.26 A Web page that calls a WCF service. The WCF service requires credentials of type UserNamePasswordClientCredential. Provide the credentials by:

wcfTs.ClientCredentials.UserName.UserName = userName;

wcfTs.ClientCredentials.UserName.Password = password;

To supply credentials of type UserNamePasswordClientCredential set properties of the UserName property.

2.27 Your Web application includes a collection named pairs that contains NameValuePair objects. The NameValuePair class implements the following interface.

interface INameValuePair

{

int ID { get; }

string Name {get;}

}

You must configure the ListBox to meet the following requirements.

* The ListBox displays the pairs collection.

* The ListBox control's SelectedValue property returns the ID of the selected item.

* The ListBox control's SelectedText property returns the Name of the selected item.

You should:

Set the DataTextField to Name.

Set the DataSource to pairs.

Set the DataValueField to ID.

The correct procedure is to set the DataSource to pairs, set the DataTextField to Name, and set the DataValueField to ID.

Set the DataSourceID to identify a DataSource control to which to bind, not a collection itself.

Set the DataTextFormatString to format the property given by the DataTextField.

2.28 Setting DbDataAdapter.MissingSchemaAction to MissingSchemaAction.AddWithKey configures the following DataColumn properties if they exist at the data source: AllowDBNull, AutoIncrement, MaxLength, ReadOnly, and Unique.

2.29 When configuring a GridView control the property to set to bind the GridView to a DataSource control is the DataSourceID. Set DataSourceID to identify a DataSource control.

2.30 The following XmlDataSource control is on a page:

<asp:XmlDataSource id="PeopleDataSource" runat="server" XPath="/People/Person"        DataFile="~/App_Data/people.xml" />

The people.xml file contains the following XML.

<?xml version="1.0" encoding="utf-8" ?>

<People>

<Person>

<Name>

<FirstName>Jared</FirstName>

<LastName>Stivers</LastName>

</Name>

<Job>

<Title>Attorney</Title>

<Description>Reviews legal issues.</Description>

</Job>

</Person>

<Person>

<Name>

<FirstName>Karina</FirstName>

<LastName>Agerby</LastName>

</Name>

<Job>

<Title>IT Director</Title>

<Description>In charge of corporate network.</Description>

</Job>

</Person>

</People>

To configure a DataList control to display the LastName and Title elements use the following code:

<asp:DataList  id="PeopleDataList" DataSourceID="PeopleDataSource"

Runat="server">

<ItemTemplate>

<table cellpadding="4" cellspacing="4">

<tr>

<td style="vertical-align:top; width:120">

<asp:Label id="LastNameLabel" Text='<%#

XPath("Name/LastName")%>' runat="server" />,

<asp:Label id="TitleLabel" Text='<%# XPath("Job/Title") %>'

runat="server" />

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

You must use an XPATH expression. The correct XPATH expressions are Name/LastName and Job/Title.

2.31 Adding code to a Web page to query a SQL Server database and retrieve a result set. Configuring a GridView control to show the query results. The GridView will dynamically sort and filter results. A result set type to bind to the GridView is a DataTable. Bind to a disconnected DataTable or DataSet to support sorting, filtering and updating.

2.32 An XmlDocument named doc with the following XML:

<subscriber class="primary" phone="555-555-1212">

<pcp id="2432" />

<address street="1 elm way" city="Waterville" state="MA" zip="01322" />

</subscriber>

Add code to change the city from Waterville to Watertown.

XmlNode addressNode = doc.DocumentElement.SelectSingleNode("descendant::address");

addressNode.Attributes["city"].Value = "Watertown";

To modify a node's attribute, first create an XmlNode object representing the node by calling SelectSingleNode and providing an XPath. Then you can directly modify the attribute.

Whew! Let’s got the fun section, the Code!

This example is a nice simple xml data source & display the data in a list using a datasource control:

This is the xml file stored in the App_Data Folder

<?xml version="1.0" encoding="utf-8" ?>

<ProductList>

<Product Id="1A59B" Department="Sporting Goods" Name="Baseball" Price="3.00" />

<Product Id="9B25T" Department="Sporting Goods" Name="Tennis Racket" Price="40.00" />

<Product Id="3H13R" Department="Sporting Goods" Name="Golf Clubs" Price="179.00" />

<Product Id="7D67A" Department="Clothing" Name="Shirt" Price="12.00" />

<Product Id="4T21N" Department="Clothing" Name="Jacket" Price="45.00" />

</ProductList>

Here is the ASPX file:

<form id="form1" runat="server">

<div>

<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="419px"

AllowPaging="True" AutoGenerateRows="False" CellPadding="4"

DataSourceID="XmlDataSource1" ForeColor="#333333" GridLines="None">

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<Fields>

<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />

<asp:BoundField DataField="Department" HeaderText="Department"

SortExpression="Department" />

<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />

<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />

</Fields>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<EditRowStyle BackColor="#999999" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</asp:DetailsView>

<asp:XmlDataSource ID="XmlDataSource1" runat="server"

DataFile="~/App_Data/ProductList.xml"></asp:XmlDataSource>

</div>

</form>

. In the next section we’ll check out the ‘Configuring & Deploying Web Applications’ which will include config files, State Management, User Authentication & Autherization, and deploying apps.

As we see we covered the ‘Displaying & Manipulating Data’ section What are your thoughts on this section?

That is all & there will be more,

Catto

Sunday, March 21, 2010

.NET 4 Debugging 70-515 Exam Prep ASP.NET troubleshooting & monitoring

.NET 4 Debugging 70-515 Exam Prep ASP.NET troubleshooting & monitoring

Hey Now Everybody,

Microsoft announced the .NET 4.0 Beta Exams on St. Patrick’s Day which are a free exam & if passed you get certified. Much of the study & prep materials are not available yet, therefore I’ve been studying for a similar exam 70-562 which is the .NET 3.5 ASP.NET Application Development. I hope by posting this content it will help myself along with other people in the community learn & get excited about .NET 4.

In this 4th post of the series  (maybe gonna name it Catto’s Code Crackin) we’ll continue with the section debugging & monitoring. In the .NET 3.5 exam troubleshooting, debugging & monitoring are ~16%. In the .NET 4 exam there is not a section dedicated to debugging however one bullet point of the ‘Configuring & Extending a Web Application’ section reads:

Debug a Web application.
This objective may include but is not limited to: remote, local, JavaScript debugging, attaching to process, logging and tracing, using local IIS, aspnet_regiis.exe

Key points from the chapter in the book are:

o You can turn on debugging for your Web apps inside the web.config file by setting the debug attribute of the compilation element to true. You can also turn on debugging at the individual page level using the debug attribute of the @ Page directive.

o You can set a custom error page for your entire site by setting the defaultRedirect attribute of the customErrors element. You can also map specific pages to HTTP status codes using the errors child element.

o The Remote Debugging monitor (Msvsmon.exe) allows you to configure debugging on a remote server.

o You can use ASP.NET tracing to troubleshoot and diagnose probs with a page in your web site. In outputs info about the request, response and the environment.

o You can use the trace method to output custom trace messages to trace log.

o An AJAX page can use the client side Sys.Debug.trace method to output tracing info to a web page.

o ASP.NET provides health monitoring tools System.WebManagement to enable you to monitor a running Web application. You can configure Web events with listeners through rule child elements of the healthMonitoring element inside Web.config

Let’s continue with some key points from practice exams:

1 When multiple versions of the .NET Framework are executing side by side on a single computer, the ASP.NET Internet Server Application Programming Interface (ISAPI) version mapped to an ASP.NET application determines which version of the common language runtime (CLR) is used for the application. The ASP.NET IIS Registration tool (Aspnet_regiis.exe) allows an administrator or installation program to easily update the script maps for an ASP.NET application to point to the ASP.NET ISAPI version that is associated with the tool.

3 You must run Aspnet_regsql.exe, which is found in %windows%\Microsoft .NET\Framework\<version>. Then you run the tool to create the schema needed by the SQL Server membership provider.

4 When examining data posted to the webserver. The trace result section we can use is the Form Collection section since it contains the posted data.

5 You can use ASP.NET tracing to view page life cycle timings.

6 Setting debug to false inside the compilation element of Web.config will turn off debugging for the entire site.

Setting the debug attribute of the @Page directive to true will turn on debugging just for the selected page.

7 To configure ASP.NET Health monitoring to log info every time a user fails to login to the server. WebAuthenticationSuccessAuditEvent -This class will send an event when a user successfully authenticates with the Web application.

8 When there is an error that is occurring when the app is deployed to the dev server. We can debug this error remotely.

A Running the Remote Debugging Monitor on the server will allow remote debugging for a given user with the appropriate rights.

B You need to attach to the process on the server that is hosting the application.

9 To redirect users to a default error page if they hit any unhandled exceptions or HTTP errors within the site

A The defaultRedirect attribute of the customErrors element will set a default sitewide error page.
B You can use the aspxerrorpath query string parameter to retrieve the requested page to display on the default error page.

10 if we want to run the trace continuously to enable you to quickly look at the 10 most recent traces from anyone using your Web site, but you are concerned about filling your hard drive with excessive data

<trace

enabled="true"

requestLimit="10"

pageOutput="false"

traceMode="SortByTime"

localOnly="false"

mostRecent="true" />

11 ASP.NET provides the Sys.Debug class for debugging client applications. You can call methods of the Sys.Debug class to can display objects in readable form at the end of the page, show trace messages, use assertions, and break into the debugger. If you are using Microsoft Visual Studio and Microsoft Internet Explorer, you can attach the Visual Studio debugger to the browser and view debugger trace messages in the Output window. If you are not using Visual Studio, you can view debugger trace messages in Internet Explorer by creating a textarea element on the page and setting its ID to TraceConsole.

12 You must configure the Web application so that the Trace.axd page will show the last 100 page requests.

<trace

enabled="true"

requestLimit="100"

pageOutput="false"

traceMode="SortByTime"

localOnly="true"

mostRecent="true"

/>

13 The ASP.NET tracing mechanism writes messages that are displayed on ASP.NET Web pages and on the ASP.NET Trace viewer (Trace.axd), whereas the Trace class is used to write trace messages to the standard .NET Framework trace output (typically a console window). To make it easier to track how the Web Forms interact with business objects and other components, you can integrate ASP.NET tracing output with System.Diagnostics tracing to route all tracing messages to one of these outputs.

14 To debug a process that is running under another account name, you must have Administrator privileges on the remote computer. If the ASP.NET worker process aspnet_wp.exe is running as SYSTEM or ASPNET, for example, you have to be an administrator on the computer where that process is running.

15 Web application that uses cookies to track user preferences, troubleshoot , the Web browser does not seem to be correctly submitting the cookie to the Web server.

Trace.axd displays all cookies that the Web browser submits to the Web server. This enables you to determine quickly whether a cookie is working properly.

16 When deploying an ASP.NET app you must choose a performance counter to determine if the webserver is processing requests fast enough. Requests Queued counter will increase only when the Web server cannot process requests faster than they are submitted. Therefore, it is the best gauge of whether the Web server can keep up with demand.

17 For debugging in ASP.NET and other server environments, you can run the Remote Debugging Monitor as a Windows service (the Remote Debugger Service). To configure the Remote Debugging Monitor as a service, use the Visual Studio 2008 Remote Debugger Configuration Wizard and follow the steps in the wizard to set up remote debugging as a service.

18 Use the TraceContext.Write method to write to the page's tracing information. The Page object includes a Trace property that references the TraceContext instance.

19 To enable tracing for an application, add <trace enabled="true"/> to the application's Web.config file in the <configuration><system.web> section.

20 ASP.NET provides the Sys.Debug class for debugging client applications. You can call methods of the Sys.Debug class to display objects in readable form at the end of the page, show trace messages, use assertions, and break into the debugger. If you are using Microsoft Visual Studio and Microsoft Internet Explorer, you can attach the Visual Studio debugger to the browser and view debugger trace messages in the Output window. If you are not using Visual Studio, you can view debugger trace messages in Internet Explorer by creating a textarea element on the page and setting its ID to TraceConsole.

21 WebSuccessAuditEvent provides information about successful security events, including successful URL authorization.

22 For errors that your code handles, you should call the Server.ClearError method. This ensures configured redirection is circumvented.

23 The simplest way to indicate a redirection target is to do so declaratively in the @Page markup.

24 Code for the following tasks:

* Display a page named PageNotFound.aspx if a page causes a 404 error.

* Display a page named Error.aspx for any other page error

<customErrors mode="On" defaultRedirect="~/Error.aspx">

<error statusCode="404" redirect="~/PageNotFound.aspx" />

</customErrors>

25. Intermittent exceptions on an ASP.NET app & remote debugging stops responding when you attempt to debug from your machine. On the test server, grant the Remote Debugging Monitor permission to configure the firewall by confirming in the User Account Control dialog box.

26 To create and install a custom performance counter, call the PerformanceCounterCategory.Create method. Ensure that you call this method once only by including it in your application install or by checking if the performance counter exists before calling.

Call the following code once only:

CounterCreationDataCollection counterDatas = new CounterCreationDataCollection();

CounterCreationData cd = new CounterCreationData();

cd.CounterName = "Shopping cart values";

cd.CounterType = PerformanceCounterType.NumberOfItems64;

counterDatas.Add(cd);

PerformanceCounterCategory.Create("Contoso Storefront", _

"Category help", PerformanceCounterCategoryType.SingleInstance, _

counterDatas);

27 Using impersonation, ASP.NET applications can optionally execute the processing thread using the identity of the client on whose behalf they are operating.

28 WebApplicationLifetimeEvent represents events that affect the life cycle of an ASP.NET application, including events such as application startup and shutdown events. If an application is terminated, you can determine why by viewing the related event message field.

29 Provide an error-handling callback function to the autogenerate Web service proxy, passing parameters in the order echoElem.value, SucceededCallback, and ErrorCallback. Handle exceptions in this method.

Samples.AspNet.SimpleWebService.EchoInput(echoElem.value,

SucceededCallback, ErrorCallback);

30 The .NET Framework 3.5 is not a stand-alone framework like version 2.0 or version 1.1. It is just an extension of the 2.0 Framework. The .NET Framework does not ship with an Aspnet_regiis.exe implementation and there is no new Internet Server Application Programming Interface DLL specific to version 3.5. To use new language features you must configure the 3.5 version of the compiler as shown.

<compiler language=..., Version=2.0.0.0, Culture=neutral,

PublicKeyToken=...>

<providerOption name="CompilerVersion" value="v3.5"/>

</compiler>

31 Configuring remoteOnly mode in the <customErrors> element of the Web.config file specifies that custom errors are shown only to remote clients and ASP.NET errors are shown to the local host.

32 To create a debug compilation, set the debug attribute of the compilation element to True.

<compilation defaultLanguage=".." debug="true">

</compilation>

33 With the Microsoft Visual Studio debugger, you can debug a Web application transparently on the local computer or a remote server. This means that the debugger functions the same way and allows you to use the same features on either computer. For remote debugging to work correctly, however, there are some prerequisites. The Visual Studio Remote Debugging Monitor must be installed on the server you want to debug.

Install the Remote Debugging Monitor (Msvsmon.exe) on the remote computer.

34 Configure rules to map an event set defined in the <eventMappings> section with a log source defined in the <providers> section.

35 A page has JavaScript calls & you must choose a location to add code to capture& log js exceptions. We can add an event handler to the window's onerror event.

The onerror event fires when an error occurs during object loading or run-time scripts.

37 You must explicitly deny unauthorized users to force a redirect to a Forms authentication login page. Do this by adding a deny element to the Web.config authorization element. Set the users attribute to "?"

<authorization>

<deny users="?" />

</authorization>

38 To enable tracing for a single page only add a Trace attribute to the @ Page directive and set its value to True.

39 To debug client script, you must attach a debugger to Internet Explorer. You can attach the Visual Studio debugger to Internet Explorer when the application is already running. To do so, from the Debug menu, select Attach To Process . . . . In the Attach To Process dialog box, select the instance of Internet Explorer (Iexplore.exe) to which you want to attach the debugger. If Internet Explorer encounters a script error and is configured for script debugging, but it is not currently attached to a debugger, the browser prompts you to select a debugger. You can either continue without debugging or attach a debugger and step through the code.

40 Configure the SqlWebEventProvider. This built-in provider will log Web events to a SQL Server database.

41 AutoEventWireup page events must be named in the format Page_Event. In this case, the event is Error (ex Page_Erro). Adding this method will ensure your application catches all unhandled exceptions.

42 ASP.NET provides the Sys.Debug class for debugging client applications. You can call methods of the Sys.Debug class to can display objects in readable form at the end of the page, show trace messages, use assertions, and break into the debugger. If you are using Visual Studio and Internet Explorer, you can attach the Visual Studio debugger to the browser and view debugger trace messages in the Output window.

We’ve covered Troubleshooting, debugging & monitoring ASP.NET applications. After putting this post together in the future some more good content would be creating some sample code to show break points & how VS10 can debug backwards. I’m really looking forward to the next section which we’ll cover ‘Working with Data & Services’. Data is very fun to work with & enables us to deliver data driven applications.

What are your thoughts of debugging code?

That is all & there will be more,

Catto

Saturday, March 20, 2010

.NET 4 AJAX - Catto Code Crackin - ASP.NET Web Dev Exam Prep

Hey Now Everybody,

Microsoft announced the .NET 4.0 Beta Exams on St. Patrick’s day which are a free exam & if passed you get certified. Much of the study & prep materials are not available yet, therefore I’ve been studing for a similar exam 70-562 which is the .NET 3.5 ASP.NET Application Development. I hope by posting this content it will help myself along with other people in the community learn .NET 4.

The section I’m going to review for our third post in the series is going to be AJAX. JavaScript is very fun to code & it creates a rich user experience. Let’s start by looking at the official skills measured in detail for the Client-Side Scripting & AJAX:

Implementing Client-Side Scripting and AJAX (16%)

1 Add dynamic features to a page by using JavaScript.
This objective may include but is not limited to:
referencing client ID;
Script Manager;
Script combining;
Page.clientscript.registerclientscriptblock;
Page.clientscript.registerclientscriptinclude;
sys.require (scriptloader)
This objective does not include:
interacting with the server;
referencing JavaScript files;
inlining JavaScript
2 Alter a page dynamically by manipulating the DOM.
This objective may include but is not limited to:
using jQuery,
adding, modifying, or removing page elements,
adding effects,
jQuery selectors
This objective does not include: AJAX
3 Handle JavaScript events.
This objective may include but is not limited to:
DOM events,
custom events,
handling events by using jQuery
4 Implement ASP.NET AJAX.
This objective may include but is not limited to:
client-side templating,
creating a script service,
extenders (ASP.NET AJAX Control Toolkit),
interacting with the server,
Microsoft AJAX Client Library,
custom extenders;
multiple update panels;
triggers;
UpdatePanel.UpdateMode;
Timer
This objective does not include:
basic update panel and
progress
5. Implement AJAX by using jQuery.
This objective may include but is not limited to:
$.get,
$.post,
$.getJSON,
$.ajax,
xml,
html,
JavaScript Object Notation (JSON),
handling return types 
This objective does not include: creating a service

Let’s continue with some more content from the book from the lesson summaries:

v AJAX communicates between code running on the client side & code running on the server.

v ASP.NET includes both a set of server controls for working with AJAX and a set of client-side JavaScript files called the MS AJAX library

v ScriptManager is required on all pages that work with AJAX extensions for ASP.NET It manages the JavaScript files sent to the client and the communication between the server & the client.

v The UpdatePanel control allows you to define an area within your page that can PostBack to the server & receive updates independent of the rest of the page.

v The UpdateProgress control is used to provide notice to the user that the page has initiated a call back to the server.

v The Timer control is used to periodically send a partial-page request updating an UpdatePanel to the server at timed intervals.

Lesson 2 summaries:

v You can define client script for a page using the Script tag. You can write JavaScript inside this tag or you can use it to point to a .js file.

v The ClientScriptManager is used to register client script dynamically from server side code. An instance of this class is accessible from the PageClientScript Property

v The ScriptManager control can also be used to register your own custom client scripts. This is useful if you are already using this control for partial page updates or to leverage the Microsoft AJAX library.

v The MS AJAX Library provides object-orientated support for building JavaScript code that extends the features of the client’s browser. This includes a set of base classes & a framework.

v There are typically 3 types of objects you can create for use with the MS AJAX library

o Components

o Controls

o Behaviors.

v You can wrap an AJAX client into a custom server control. To do this you implement the IScriptControl interface.

------------------- Question Key Points ------------------

Below are some key points made by the questions asked in the practice exam. The numbers are not important & I’m only using them as a little guide along with a way to separate each key point.

3 The UpdateProgress control provides status information about partial-page updates in UpdatePanel controls. You can customize the default content and the layout of the UpdateProgress control.

4 The ClientScriptManager.GetCallbackEventReference method obtains a reference to an automatically generated client function that, when invoked, initiates a client callback to a server event. Call the function returned by this method to invoke a callback. The automatically generated client function will invoke the actual request.

5 Define the JavaScript in an .aspx page that includes a ScriptManager control. The presence of a ScriptManager class will ensure that ASP.NET AJAX client libraries are available to your client code

6 You are implementing a Web page. You must configure the page and Web application to ensure that you can use the Sys.Services.AuthenticationService to verify credentials from the browser using JavaScript. ?

You must include a ScriptManager control to ensure that the Sys.Services.AuthenticationService is defined.
The application must use Forms authentication.

7 You are creating a custom ASP.NET server control that uses JavaScript functions to implement AJAX functionality for ASP.NET. You want to distribute the functions with the server control's assembly.

Put the JavaScript functions in a JavaScript (.js) file and embed the file into the assembly and apply the WebResourceAttribute attribute to the assembly to reference the resource.
Simply including a JavaScript (.js) file does not ensure it is included in the same assembly as the server control.

8 By using the complex JavaScript type generated by the ScriptManager class you can easily access complex type data members with no additional custom code.

9 Any ASP.NET page that includes an UpdatePanel control also requires a ScriptManager control. To use UpdatePanel controls with master pages, you can put a ScriptManager control on the master page. The ScriptManagerProxy class enables nested components such as content pages and user controls to add script and service references to pages when a ScriptManager control is already defined in a parent element. Include a ScriptManager on the master page and include the ScriptManagerProxy on the content page.

10 The RegisterClientScriptBlock method adds a script block to the top of the page. You create the script as a string, and then pass it to the method, which adds it to the page. You can use this method to insert any script into the page.

11 You are implementing a Web page. You must add a service that will allow you to verify credentials from the browser by using JavaScript. Credentials are stored as part of the ASP.NET membership service.

Add the following to the application's Web.config file:

<system.web.extensions>

<scripting>

<webServices>

<authenticationService enabled="true" />

</webServices>

</scripting>

</system.web.extensions>

Enable the built-in ASP.NET AJAX application service by adding the configuration values shown to the Web.config file.

12 To load the JavaScript code, add a script reference to the page's ScriptManager control. Set the script reference's assembly attribute to the assembly name and set the name attribute to the resource name.

13 Define triggers to indicate which control events will cause an UpdatePanel to render itself. By designating the DropDownList control as an AsyncPostBackTrigger and setting the trigger event name to SelectedIndexChanged, you can cause the UpdatePanel to refresh even if the DropDownList is not in the UpdatePanel.

14 The enableWebScript behavior sets the default data format for the service to JSON instead of XML.

15 The UpdatePanel class enables sections of a page to be partially rendered without a PostBack. Include the button in the UpdatePanel to trigger the partial refresh.

16 The ScriptManager control is used to make a proxy to the service accessible through JavaScript. Add a service reference to the ScriptManager as shown here:

<asp:ScriptManager ID="ScriptManager" runat="server">

<Services>

<asp:ServiceReference Path="service.svc" />

</Services>

</asp:ScriptManager>

17 The EnablePartialRendering property enables or disables partial rendering of a page. Set this property to True to enable the update regions of the page individually by using UpdatePanel controls

19 Use the following markup:

<asp:button id="Button1" runat="server"

text="Button1" onClientClick="validateCallbackComplete();" />

Adding a client script onclick event to buttons requires a special procedure. Set the OnClientClick attribute to set the client-side script that executes when a Button control's Click event is raised.

20 The Sys.Services.RoleService class provides a client proxy class for the ASP.NET role service. Use this class in client-side code to test role membership.

21 The ScriptMethodAttribute attribute specifies which HTTP verb is used to invoke a method, and the format of the response. It defaults to the JSON format.

23 To ensure run time information is available dynamically, generate a string that gives the script. Call the RegisterOnSubmitStatement method of the ClientScriptManager to configure the script to execute on submit.

25 The Timer control enables you to perform PostBacks at a specified interval. When you use the Timer control as a trigger for an UpdatePanel control, the UpdatePanel control is updated by using an asynchronous, partial-page update. You use the Timer control to update an UpdatePanel control by including the timer inside the UpdatePanel control. Alternatively, you can place the timer outside the UpdatePanel control and set the timer as a trigger.

27 You are implementing an ASP.NET Web page. The page uses client script that is implemented in a JavaScript (.js) file named Contosolib.js. You must add markup to ensure that the page meets the following requirements.

* The page includes the JavaScript file functions when the page renders.

* The page supports partial rendering.

28 Register a new class you intend to use as an extension to a DOM element :
MyNamespace.MyClass.registerClass('MyNamespace.MyClass ', Sys.UI.Control);
You must derive from the Sys.UI.Control class to create an AJAX UI control.

30 An UpdateProgress control is used to display text or graphics during a partial-page update. The DisplayAfter attribute controls how long the page waits from the start of the request until it displays the progress indicator. If the request returns during this time, the progress indicator is not shown.

31 The Copy Web tool detects when a version of a file has been modified on the Web server after it is synchronized with the local copy of a file. Therefore, it can detect versioning conflicts when multiple developers work on a single site.

Whew! Let’s get to a little more fun section the Catto Code Cracker section, this is the section where we review code & how to really make it happen. Whoo Ha!

This is a nice little example that enters a record in a gridview & the page doesn’t postback.

Here is the ASPX file important lines:

<head id="Head1" runat="server">

<title>Ajax Example</title>

</head>

<body style="font-family: Verdana">

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<div>

<div style="font-size: large;">Vendors</div>

<hr />

<div style="margin: 20px 0px 20px 40px">

Name<br />

<asp:TextBox ID="TextBoxName" runat="server" Width="200"></asp:TextBox>

<br />

Location<br />

<asp:TextBox ID="TextBoxLocation" runat="server" Width="200"></asp:TextBox>

<br />

Contact Name<br />

<asp:TextBox ID="TextBoxContact" runat="server" Width="200"></asp:TextBox>

<br />

Contact Phone<br />

<asp:TextBox ID="TextBoxPhone" runat="server" Width="200"></asp:TextBox>

<br />

<asp:Button ID="ButtonEnter" runat="server" Text="Enter"

style="margin-top: 15px" onclick="ButtonEnter_Click" />

</div>

<asp:UpdatePanel ID="UpdatePanelVendors" runat="server">

<Triggers>

<asp:AsyncPostBackTrigger ControlID="ButtonEnter" EventName="Click" />

</Triggers>

<ContentTemplate>

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"

AutoGenerateColumns="False" DataKeyNames="id"

DataSourceID="SqlDataSourceVendors" Width="580px" Font-Size="Small"

CellPadding="4" ForeColor="#333333" GridLines="None">

<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

<RowStyle BackColor="#EFF3FB" />

<Columns>

<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"

ReadOnly="True" SortExpression="id" />

<asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" />

<asp:BoundField DataField="location" HeaderText="Location"

SortExpression="location" />

<asp:BoundField DataField="contact_name" HeaderText="Contact Name"

SortExpression="contact_name" />

<asp:BoundField DataField="contact_phone" HeaderText="Contact Phone"

SortExpression="contact_phone" />

</Columns>

<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />

<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

<EditRowStyle BackColor="#2461BF" />

<AlternatingRowStyle BackColor="White" />

</asp:GridView>

<asp:SqlDataSource ID="SqlDataSourceVendors" runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionStringVendors %>"

SelectCommand="SELECT [id], [name], [location], [contact_name], [contact_phone] FROM [vendor] Order by [name]">

</asp:SqlDataSource>

</ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

Here is the important lines from the .CS code behind file:

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void ButtonEnter_Click(object sender, EventArgs e)

{

System.Configuration.Configuration webConfig =

System.Web.Configuration.WebConfigurationManager.

OpenWebConfiguration("/AjaxExample");

string cnnStr =

webConfig.ConnectionStrings.ConnectionStrings[

"ConnectionStringVendors"].ConnectionString;

SqlConnection cnn = new SqlConnection(cnnStr);

SqlCommand cmd = new SqlCommand("insert_vendor", cnn);

cmd.CommandType = CommandType.StoredProcedure;

SqlParameter pName = new SqlParameter("@name", SqlDbType.VarChar);

pName.Value = TextBoxName.Text;

cmd.Parameters.Add(pName);

SqlParameter pLocation = new SqlParameter("@location", SqlDbType.VarChar);

pLocation.Value = TextBoxLocation.Text;

cmd.Parameters.Add(pLocation);

SqlParameter pContactName = new SqlParameter("@contact_name",

SqlDbType.VarChar);

pContactName.Value = TextBoxContact.Text;

cmd.Parameters.Add(pContactName);

SqlParameter pContactPhone = new SqlParameter("@contact_phone",

SqlDbType.VarChar);

pContactPhone.Value = TextBoxPhone.Text;

cmd.Parameters.Add(pContactPhone);

cnn.Open();

cmd.ExecuteNonQuery();

//rebind the grid

GridView1.DataBind();

}

}

We’ve covered some the AJAX section by viewing the skills measured in the exam, the main points from the chapter in the book. Reviewed some key points from samples questions & reviewed some code. I’m ready to view some more code now & go onto the next section.

That’s all there is there will be more,

Catto

Thursday, March 18, 2010

71-515 .NET 4 Web Dev Server Controls

Hey Now,

Let’s continue with the MS .NET 4 Web Dev Beta exam 71-515!

Server controls should be a good place to start, it’s a high percentage in both exams .NET 3.5 & 4, very important topic since it’s used all the time. After rereading the skills measured the key point for this sections are as follows:

1. Validate User Input
2. Create Page Layout
3. Implement User Controls
4. Implement Server Controls
5. Interface Controls from Code Behind

Let’s get into some detail from the 3.5 book on controls.

‘Adding & Configuring Server Controls’ – is a chapter and broken up into 3 lessons

Understanding & Using Server Controls
Exploring Common Server Controls
Exploring Specialized Server Controls

Developing and Using Web Forms Controls (18%)

  • Validate user input.
    This objective may include but is not limited to:
    • client side,
    • server side, and
    • via AJAX;
    • custom validation controls;
    • regex validation;
    • validation groups;
    • datatype check;
    • jQuery validation
      This objective does not include:
      • RangeValidator and
      • RequiredValidator
  • Create page layout.
    This objective may include but is not limited to:
    • AssociatedControlID;
    • Web parts;
    • navigation controls;
    • FileUpload controls
      This objective does not include: 
      • label;
      • placeholder,
      • panel controls;
      • CSS, HTML, referencing CSS files, inlining
  • Implement user controls.
    This objective may include but is not limited to:
    • registering a control;
    • adding a user control;
    • referencing a user control;
    • dynamically loading a user control;
    • custom event;
    • custom properties;
    • setting toolbox
    • visibility
  • Implement server controls.
    This objective may include but is not limited to: composite controls,
    • INamingContainer,
    • adding a server control to the toolbox,
    • global assembly cache,
    • creating a custom control event,
    • globally registering from web.config;
    • TypeConverters
      This objective does not include:
      • postback data handler,
      • custom databound controls,
      • templated control
  • Manipulate user interface controls from code-behind.
    This objective may include but is not limited to: HTML encoding to avoid cross-site scripting, navigating through and manipulating the control hierarchy;
    • FindControl;
    • controlRenderingCompatibilityVersion;
    • URL encoding;
    • RenderOuterTable
      This objective does not include properties:
      • Visibility
      • Text
      • Enabled

Below is the skilled measured from the MS official page http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-515&locale=en-us#tab2

There are many examples used here are some examples of key points made in the sample exam. The #’s are not in numberical order but just use them as a guide for a little organization:

3 You can use a RegularExpressionValidator to validate the format of almost any kind of text input. The Microsoft Visual Studio interface provides standard regular expressions to match phone numbers.

4 HierarchicalDataBoundControl is provided as the base class for hierarchical controls, such as those that provide a tree or menu structure.

5 Setting the AutoPostBack property to False will prevent the page from posting each time the text change

6 Page.IsValid returns True if all validators on the page were successful.

7 You can use the MultiView control to perform tasks such as the following:
* Provide alternate sets of controls based on user choice or other conditions.
* Create a multipage form.

8 The ASP.NET ListView control enables you to bind to data items that are returned from a data source and display them. By supporting templates, it provides a fine control over the rendered output. By associating a DataPager with the ListView you can easily support paging.

9 To configure the Alt+N access key, set the LabelName control's AssociatedControlID property to TextBoxName and set the LabelName control's AccessKey property to N.

10 By default, events raised by TextBox controls are not processed until the user presses a button or performs some other action that sends a response to the server. To cause the event to be processed immediately, set the control's AutoPostBack property to True.

11 You use the @ Register directive when you add a user control to the page declaratively.

12 Use the PlaceHolder control as a container to store server controls that are dynamically added to the Web page. The PlaceHolder control does not produce any visible output and is used only as a container for other controls on the Web page. You can use the PlaceHolder.Controls collection to add, insert, or remove a control in the PlaceHolder control.

13 Setting the form's DefaultButton property to the ID of the button to click if the user presses Enter will have the desired result.

14 The DetailsView control displays a single record from a data source, where each data row represents a field in the record. It provides paging and editing capabilities

15 With templated controls, you should always use the Placeholder control. Developers who implement your templated control can then add their own control types.

18 To perform validation that occurs on the client-side, you must add a JavaScript function to your page.

To configure the CustomValidator to recognize and invoke your client-side validation function, set the CustomValidator.ClientValidationFunction to the name of the function.

19 Given the requirements, you should create a templated control using ITemplate. Templated controls allow you to separate the control data from the presentation so other developers can implement the user interface at design time. The developer creates templates of the type defined by the user control and can then add controls and markup to the templates.

21 The DataGrid control requires you to write a lot of custom code to handle common operations such as paging, sorting, editing, and deleting data. The GridView supports these capabilities automatically.

24 CustomValidator enables you to write custom code to validate input, which would be required to check input against a database

25 When overriding the PerformSelect method, you must follow a very orderly structure. First, check whether DataSource or DataSourceID is being used. If DataSource is being used, call the OnDataBinding method. Then, you must perform tasks in a specific order to ensure dependencies are fulfilled. First, call the Select method. Then, set RequiresDataBinding to False and call MarkAsDataBound. Then, raise the DataBound event.

26 DetailsView, FormView, and GridView all support paging, which enables you to display the data across multiple pages.

Menu, TreeView, and DataList do not support paging. Therefore, you must display all of their data on a single page.

28 To set default focus in a form or panel, set the DefaultFocus attribute of the form element in the page or of a Panel control to the ID of the control to receive focus

29 Use the PlaceHolder control as a container to store server controls that are dynamically added to the Web page. The PlaceHolder control does not produce any visible output and is used only as a container for other controls on the Web page. You can use the PlaceHolder.Controls collection to add, insert, or remove a control in the PlaceHolder control.

20 A template property is one that returns a value of type ITemplate. You must apply the TemplateContainer attribute to template properties.
[TemplateContainer(typeof(SimpleRepeater)) ]

public ITemplate ItemTemplate
{
...
}

30 You use the @ Reference directive when you intend to load the control programmatically.

31 The scenario calls for a custom server control. To create a custom server control, extend the WebControl class and override the Render method.

32 The easiest way to require the user to complete a TextBox control is to add both the TextBox control and the RequiredFieldValidator controls beside each other and then specify the RequiredFieldValidator.ControlToValidate and RequiredFieldValidator.ErrorMessage properties.

35 The Page.LoadControl method loads a Control object from a file based on a specified virtual path.

36 When you develop templated controls, you should implement the INamingContainer interface to avoid naming conflicts on a page. INamingContainer creates a new ID namespace within a page's control hierarchy, guaranteeing that all names will be unique.

37 The ValidationSummary control will display detailed error information if you add it to the page with the ChangePassword control and set the ValidationSummary.ValidationGroup property to the ID of your ChangePassword control.

39 The DataPager provides paging functionality for data-bound controls that implement the IPageableItemContainer interface, such as the ListView control.

Let’s get to some code!
The specialized server controls code is a nice example. It has three basic screens the user selects an office, clicks next, selects a date, clicks next then there is a summary page, click finish & then a confirmation page. The image uses a nifty property hotspot, along with a wizard control. The main point being these controls are more specialized & not used as often.

Here is some code from an example of using server controls:

ASPX File:
<asp:Label ID="LabelInformation" runat="server"></asp:Label>
<br />
User Name<br />
<asp:TextBox ID="TextBoxUserName" runat="server" MaxLength="12"></asp:TextBox>
<br />
<asp:CheckBox ID="CheckBoxAdmin" runat="server" Text="System Administrator"
AutoPostBack="True" oncheckedchanged="CheckBoxAdmin_CheckedChanged" />
<br />
Applicaiton role:
<br />
<asp:RadioButton ID="RadioButton1" runat="server" Text="User"
GroupName="ApplicationRole" />
&nbsp;<asp:RadioButton ID="RadioButton2" runat="server" Text="Manager"
GroupName="ApplicationRole" />
&nbsp;<asp:RadioButton ID="RadioButton3" runat="server" Text="Director"
GroupName="ApplicationRole" />
<asp:Button ID="ButtonSave" runat="server" Text="Save"
onclick="ButtonSave_Click" />

.CS File important lines of code:
protected void ButtonSave_Click(object sender, EventArgs e)
{
LabelInformation.Text = "User information saved.";
}
protected void CheckBoxAdmin_CheckedChanged(object sender, EventArgs e)
{
if (CheckBoxAdmin.Checked)
{
CheckBoxAdmin.Text = "System Administrator";
}
else
{
CheckBoxAdmin.Text = "Check to set as system administrator";
}

}

Below are a few more sample questions from the book, they can be good for us to focus on some key concepts:
Chapter 2

Q1 Q How to add an HTML Server control :
A To convert an HTML element into a server control you add the runat+”server” attribute & value to the element

Q2 How to make a CheckBox cause an automatic PostBack
A To indicate that a control’s default event should cause a Postback you set the AutoPostBack property of the control to true

Q3 Q Dynamically create an instance of Textbox. Which page event? Preinit ofcouse
A The PreInit event is where you want to create & recreate your dynamically generated controls. This ensursures they will be available for initialization. ViewState connection & code inside other events such as Load.

Q4 Q: write code to dynamically create an instance of a Textbox server control. You want to make sure the control displays on the page: Call the ShowControl Method on the TextBox.
A Dynamically created control must be added to the form element assosciated with the page. The form element must also be set to runat=”server”

Lesson 2

Q1 Q If radiobutton
The RadioButton controls GroupName Property is used to group two or more mutually exclusive radio buttons.

Q2 Other than the normal submit button use the Command Button.
A. You Create a commond button by setting the CommandName property of the button & responding to the Command event for the button.

Q3 Q How to create an event handler for a server control.
D The easiest way to create an event handler for the default event of a control is to double click the control in Design view.

Lesson 3

Q1 Best use of Table, TableRows & TableCells is good for displaying tabular set of data

Q2 Best way to incorporate an imange on a site for navigation.
D The imageMap provides the ability to define hot spot areas & the PostBackValue can be used to determine the area that was clicked.

Q3 C Wizard Control:
The Wizard control will solve this issue by providing an easy to implement solution for collecting multiple page data from users.

There we have it, there is quite a bit of content on ASP.NET Server Controls.

That is all, and there will be more!

Bye now,

Catto