MCSD .NET 70-315 Short Notes: Exam Passing Tips

Creating User Services

  • The SessionID property of the HttpSessionState class identifies an active ASP.NET session by using a unique session ID.
  • The @ Import directive is used to explicitly import a namespace into an ASP.NET application.
  • The @ Implements directive is used to implement a specified .Net Framework interface in a Web page.
  • The CodeBehind attribute of the @ Page directive specifies the name of the compiled file that contains the class associated with the page.
  • The ErrorPage attribute of the @ Page directive is used to set the URL if an unhandled exception occurs. Sam can set this target to the home page.
  • The Language attribute of the @ Page directive specifies the language used while compiling the inline rendering and code declaration blocks.
  • The Inherits attribute of the @ Page directive specifies a code-behind class for the page to inherit. It can be any class that is derived from the Page class.
  • Public variables and objects can be accessed from all other procedures and functions in all the modules in the same project.
  • The public class Manager : HeadOfDept declaration will create a class named Manager, which implements the HeadOfDept interface.
  • A Web page can be converted to a user control via code byin the following manner:
    • Change the extension of the Web page from .aspx to .ascx.
    • Create an @ Control directive at the top of the page, instead of an @ Page directive.
    • Remove the <html>, <head>, <body>, and <form> elements from the ASP.NET code.
  • The EnableSessionState attribute in the @ Page directive defines session-state requirements for a Web page.
  • The IsPostBack property of the Page class can be used to get a value that tells whether a page is loaded in response to a client postback or it is loaded for the first time. It returns false if the page is loaded and accessed for the first time.
  • The EnableEventValidation attribute of the @ Page directive is used to validate .aspx page events in postback requests and callback scenarios.
  • Stateless objects do not hold private state accumulated from the execution of one or more client calls. They are generally created to allow the pooling of components for scalability purposes.
  • The ToolTip property of the WebControl class is used to display text when the mouse pointer hovers over a Web server control.
  • The RepeatDirection property of the CheckBoxList control specifies a value indicating whether or not the control displays the items vertically or horizontally.
  • The ToolboxBitmapAttribute class is used to define images associated with a component.
  • The ChildItems property retrieves a MenuItemCollection object that contains the submenu items of the current menu.
  • In ASP.NET, the hyphen (-) symbol is used to denote the sub-properties of a custom server control. This refers to the Name property by using Font-Name.
  • The ControlToValidate property of the BaseValidator class is used to specify the input control to validate data.
  • The IsValid property of the IValidator class determines whether the associated input control passes validation.
  • The MergeStyle method of the WebControl class copies non-blank elements of a specified style to a Web control without overwriting the existing style elements of the control.
  • A Web user control creates the control using the same technique, which is used in the creation of wWeb form pages.
  • The ApplyStyle method is used to copy the non-blank style elements of the specified style to a control. It will overwrite the previous styles of the control.
  • A constructor is used to create an object that is an instance of a class. It has the same name as the class in which it resides.
  • Several RadioButton controls on a Web form do not automatically interact with each other. In order to let several RadioButtons on a Web form interact with each other, they must be logically placed in a group by using the GroupName property of each control.
  • A HyperLink control is a Web server control that displays a link to another Web page. Clicking on the hyperlink opens the linked Web page. The NavigateUrl property of a HyperLink control is used to specify the URL to navigate to when it is clicked.
  • A Web user control has both the user interface and a code-behind file and cannot be added to the Visual Studio.NET Toolbox. If multiple applications need to use a Web user control, a separate copy of the control is required in each application.
  • The AccessKey property of a Web server control is used to specify the access key for the control. This property can be set to only a single character string.
  • The HtmlForm control is used to create a server-side control. It is used to map the element of HTML. It allows a user to create a container for the elements in a Web page.
  • The AlternateText property of an Image control is used to specify an alternate text to display in the Image control. The text is displayed in the Image control when the image specified by the ImageUrl property is not available.
  • The IsWeekend property of the CalendarDay class is used to determine whether the date represented by an instance of this class is either a Saturday or a Sunday.
  • The IsOtherMonth property of the CalendarDay class is used to determine whether the date represented by an instance of this class is in a month other than the current month.
  • The EnableViewState attribute of the @ Page directive indicates whether or not the view state is maintained across page requests.
  • Authentication is a process of verifying the identity of a person, network host, or system process.
  • A Microsoft Visual Studio .NET Enterprise template helps to create solutions for a distributed application.
  • The ViewState property of the Control class allows developers to save and restore the view state of a server control across multiple requests for a page.
  • The AutoPostBack property of the TextBox control specifies whether or not an automatic postback to the server will occur whenever the content of a text box is changed. This property works properly only if a browser is set to allow scripting.
  • The timeout attribute of authentication specifies an integer value in the number of minutes for which a user’s cookie is valid.
  • The NavigateUrl property of a HyperLink control is used to specify the URL to navigate to when it is clicked. On a Web page, a HyperLink control is normally displayed as the text that is specified in its Text property. To make a HyperLink control displayed as an image, its ImageUrl property is set with the path to the image.
  • Smart navigation is best used with ASP.NET pages that require frequent postbacks.
  • The CausesValidation property of the ImageButton class is used to set a value to indicate whether validation is performed on a Web server control when an ImageButton control is clicked.
  • The InfoBox dialog box of the info method displays general information messages.
  • In order to display error messages in a bulleted list inline, the ErrorMessage property of the RequiredFieldValidator control should be used instead of the Text property.
  • The PropertiesValid property of the BaseValidator class is used set a value to indicate whether or not the control specified by the ControlToValidate property is a valid control.
  • When the InitialValue property of a RequiredFieldValidator control is set to a value, users need to select or enter a value in the associated input control other than the value in the InitialValue property. Otherwise, the validation fails upon the input control losing focus.
  • The ClientValidationFunction property of the CustomValidator class specifies the name of the custom client-side script function used for validation.
  • The ServerValidate event for a CustomValidator control is raised when validation is performed on the server.
  • A user can display all the validation error messages on a Web page in a message box by setting the ShowMessageBox property of the ValidationSummary control to True.
  • A RequiredFieldValidator control is used to check whether or not an input control contains a value.
  • A RegularExpressionValidator control is used to check whether or not the value entered into a form field matches the pattern specified by a regular expression.
  • The throw statement is used to generate exceptions intentionally. It can rethrow a caught exception. The exceptions should be caught in a try/catch block. An exceptional condition that arises inside a try block is caught in a catch block.
  • The ArgumentException exception is thrown when a method is invoked and when at least one of the arguments passed by that method does not match the parameter specification of the method.
  • The ArgumentOutOfRangeException exception is thrown when a method call returns a value that is outside the range of acceptable values.
  • The try block contains code where errors may occur. Every try block is associated with one or more catch blocks.
  • The Class property of the SqlException class returns the severity level of errors that are returned from the SQL Server .NET data provider.
  • The Source property of the SqlException class returns the name of the provider generating the error.
  • The State property of the SqlConnection class returns the current state of the connection.
  • The DataSource property of the SqlConnection class returns the name of the SQL Server to which the application is to be connected.
  • The ErrorProvider control is used to provide a user interface for indicating whether or not a control has an error associated with it.
  • The SetError method of the ErrorProvider control is used to specify the error description string for a specified control.
  • The State property of the SqlError class is used to retrieve a numeric error code returned from a SQL server database representing an error or a warning message.
  • In a try structure with multiple catch blocks, the catch block that handles the most specific exception appears before the catch block that handles the most generic exception. The most specific catch block that can handle DirectoryNotFoundException is the one that handles IOException exception.
  • A new file extension .aspx is used instead of the .asp file extension for ASP.NET Web pages so that the existing ASP application code can be incorporate into the ASP.NET Web pages. The aspnet_wp.exe process is also used for the processing of ASP .NET Web pages.
  • The DataViewRowState.ModifiedCurrent value for the RowStateFilter property is used to display the modified version of the original data.
  • The XmlValidatingReader class is inherited from the XmlReader class and is used for data validation.
  • The InferSchema value of the XmlReadMode enumeration is used to ignore an inline schema, infer schema from data, and load the data. If a DataSet object already contains a schema, the schema is extended by adding new tables or columns to the tables.
  • The DataBind method of the Page class binds a data source to the invoked server control and all its child controls.
  • The ReadLine method of the StreamReader class reads a line of characters from the current stream and returns the data as a string.
  • The StreamReader class implements a TextReader that reads characters from a byte stream in a particular encoding.
  • The System.IO.File.OpenText method creates a StreamReader that reads from an existing text file having the specified path.
  • The ReadLine method of the StreamReader class reads a line of characters from the current stream and returns the data as a string.
  • The ItemCommand event occurs when any button is clicked in the DataGrid control.
  • A Web service client can be any component or application that references and uses a Web service. It can be a client-based application or a Web application.
  • SOAP is an XML-based protocol and defines rules for data encoding.
  • The SoapUnknownHeader class is used to handle data received from a SOAP header but not understood by any recipient Web service.
  • While defining and processing SOAP headers, a class representing data in a particular SOAP header needs to be defined. The class must be derived from the SoapHeader class.
  • The Session object is used to create a variable that will be available as long as the session is active.
  • Web references refers to XML Web services that are published on either a local intranet or the Internet.
  • The Type Library Importer (Tlbimp.exe) tool is used to convert the type definitions from a COM type library into equivalent definitions in a common language runtime assembly.
  • The MemberName property of the SoapHeaderAttribute class specifies the member of the XML Web service that represents the SOAP header contents.
  • If a Web service is inaccessible from the computer or network on which it is installed, the Web Services Description Language (Wsdl.exe) tool can be used to create the proxy class manually. This proxy class file is then added to the application project.
  • The new operator in C# implies creation of an instance of a type, but does not necessarily imply dynamic allocation of memory. The new operator creates an object with no members, calls the constructor for that object, and passes a reference to the newly created object by using the this pointer.
  • The culture attribute of the globalization section is used to specify the default culture for processing incoming requests from the Web site.
  • The ResourceManager class provides access to culture-specific resources at runtime. It looks up culture-specific resources, provides resource fallback when a localized resource does not exist, and supports resource serialization.
  • The CultureInfo class is used to represent information about a specific culture including the language, the writing system, the calendar used, etc.
  • Cultures are generally grouped into three categories. They are the neutral, specific, and invariant cultures.
  • The <globalization> section of the Web.config file configures the globalization settings of an application. The culture attribute of the globalization section specifies the default culture for processing incoming requests from the Web.
  • The InvariantCulture property of the CultureInfo class is culture-independent and is not associated with any specific country or region.
  • When the TextChanged event of a TextBox control is fired, the text typed in one TextBox control will also appear in another TextBox control.
  • A method bound to an event is known as an event handler. It executes when the associated event is raised. The Control1_TextChanged event handler will execute when the TextChanged event of a control is raised. The TextChanged event of the TextBox control occurs when the Text property value is changed.
  • A RequiredFieldValidator control is used to check whether or not an input control contains a value.
  • The EditCommand event of the DataGrid control occurs when users click the Edit button for a DataGrid item. The EditItemIndex property of the DataGrid control specifies the index of an item in the DataGrid control to edit. It is used to programmatically control which item is being edited.
  • The SelectedIndexChanged event of the ListBox control occurs when the selection on the list changes and is posted back to the server.
  • The SelectionMode property of the ListBox control is used to get or set the selection mode of the ListBox control. By sSetting this property to Single ensures that users can select only a single product at a time.
  • The ItemDataBound event occurs when an item is data bound to the DataGrid control. This event provides the last opportunity for accessing a data item before it is displayed on the client.
  • When the AutoPostBack property is set to true, an automatic postback to the server occurs whenever the text in a text box is changed. The postback to the server occurs in any one of the following conditions:
    • A user presses the ENTER key
    • A text box loses focus after its content is changed.
  • The output caching is a technique that allows subsequent requests for a particular page so that the code that initially creates the page does not need to be run upon subsequent requests.
  • An element is a predefined configuration section of the .NET Framework, which contains custom application settings.
  • The Execute method of the HttpServerUtility class is used to execute a request to another page using a specified URL path to the page. It continues to execute the original page after completing the execution of the new page.
  • The AutoPostBack property works properly only if a browser is set to allow scripting. By default, a browser is set to allow scripting, but some users disable it for security reasons.

Creating and Managing Components and .NET Assemblies

  • The Resgen.exe (Resource File Generator) tool is used to convert text (.txt) files and XML-based resource format (.resx) files to common language runtime binary .resources files, or vice versa.
  • The Assembly Linker (Al.exe) tool is used to generate a file with an assembly manifest from one or more files. These files are either resource files or modules.
  • The Assembly Registration (Regasm.exe) tool is used to read the metadata within an assembly. It also adds the necessary entries to the registry allowing a COM client to create .NET Framework classes. Once a class is registered using Regasm.exe, a COM client can use it as a COM component.
  • Strong name is a name consisting of an assembly’s identity, public key, and digital signature. It includes the assembly’s name, version number, and other related information (if any).
  • Web applications that generate contents at runtime use satellite assemblies. They use satellite assemblies for storing translated string and other aspects of an application’s user interface that are culture-dependent.
  • The Strong Name (Sn.exe) tool is used to sign assemblies with strong names. It also provides signature generation, signature verification, and key management.
  • The pageOutput attribute of the @Page directive specifies whether or not trace output is rendered at the end of each page of an application.
  • The requestLimit attribute of the @Page directive specifies the number of trace requests to be stored on the server. The trace is automatically disabled if the limit is reached.
  • The assemblies that contain culture-neutral resources are referred to as satellite assemblies. These assemblies are used to deploy language-specific resources for an application. They do not contain any executable code but contain only such resources that are culture-neutral.
  • A sealed class is a class that cannot be derived from. Sealed classes are primarily used to prevent unintended derivation.
  • Web Forms pages can be converted via code into ASP.NET user controls.

Consuming and Manipulating Data

  • The inner join is used to retrieve records from two tables that are combined and added to a query’s result set. The result can be retrieved only when the values of the joined fields meet a specified criteria.
  • An attribute name must begin with a letter or an underscore. A string value assigned to an attribute is delimited using either single quotes or double quotes.
  • The OLE DB .NET data provider is used by applications to connect to a SQL Server 6.5 database or its earlier versions.
  • DataSet and DataRelation objects are used to create a relationship between these two databases to retrieve records.
  • When data tables are fetched from the databases they must be stored in the DataSet. Datagrid is used to show the data tables on the application form.
  • The OleDbConnection class represents an open connection to an OLE DB data source, a Microsoft SQL Server 6.x database, or earlier version.
  • The OleDbCommand object represents a stored procedure or a SQL statement to execute at a data source.
  • The MinPoolSize value of the ConnectionString property of the SqlConnection class is used to specify the minimum number of connections allowed in a pool.
  • A connection string is modified to use the same login ID and password for all connections to a database. This will enable the application to use a single connection pool.
  • The NextResult method of the SqlDataReader class is used to process multiple results that are generated by executing a stored procedure.
  • The Fill method of the DbDataAdapter class is used to add rows in a DataSet to match those in a data source.
  • The Add method of the DataRelationCollection class adds a DataRelation object to the collection of DataRelation objects in a DataSet.
  • The ContinueUpdateOnError property of the SqlDataAdapter class gets or sets a value that specifies whether to generate an exception, or the row in error when an error is encountered during a row update.
  • The Dispose method of the SqlConnection class is used to explicitly close the connection with a database. It immediately releases the resources used by a SqlConnection object.
  • The Sort property of the DataView class specifies the sort column names. Column names are specified in the Sort property followed by ASC (for ascending order) or DESC (for descending order). However, columns are sorted in ascending order by default.
  • The MySqlReader[“”Name””] statement is used to retrieve data. Here, Name specifies the name of the field from where data is to be accessed. The ordinal number of a field can also be used instead of the field name.
  • The ExecuteNonQuery method of the SqlCommand class is used to execute commands that change a database. These commands include the Transact-SQL INSERT, UPDATE, DELETE, and SET statements.
  • The AcceptChanges method of the DataTable class commits all changes made to a table since the method was last called.
  • The OleDbDataAdapter class is used to represent a database connection and a set of data commands that are used to fill the DataSet and update the data source. It is used as a bridge between a DataSet and data source to save and retrieve data.
  • The EnableViewState property of a DataGrid control specifies whether or not the server control maintains its own view state and the view states of its child controls. By setting this property to false will improve the performance of the application, as it will disable the view states.
  • The LoadDataRow method of the DataTable class finds the matching value and updates a specific row in the primary column of a specific table. If the value does not match, a new row is created.
  • The RowFilter property of the DataView class is used to get or set the expression to filter the rows to be viewed in a DataView object. The expression for the property includes a column name defined in a database table, an operator, and a value to filter on.
  • The SqlConnection class represents an open connection to a Microsoft SQL Server. It is used to represent a unique session to a Microsoft SQL Server 7.x database or later.
  • The ApplyDefaultSort property of the DataView class is used to automatically sort data, in ascending order, based on the primary key column(s) of a table. This property applies to a table only when the table has a primary key defined and the Sort property of the DataView object is set to a null reference or an empty string.
  • The Clear and ClearContent methods of the Response object clear all content output from the buffer stream.
  • The RepeatDirection property of the CheckBoxList control specifies a value indicating whether or not the control displays the items vertically or horizontally.
  • The Select method of the DataTable class gets an array of DataRow objects. The parameter provided in this method specifies the criteria on the basis of which the rows are retrieved from the DataTable object.
  • The SelectedItem property of the ListControl retrieves a selected item having the lowest index in the list control.
  • The DataRowState value specifies whether the DataRow object is added, deleted, detached, modified, or unchanged. When the AcceptChanges method is called, it changes the DataRowState value that is stored in the RowState property of the DataRow class.
  • The Label1.Text = SqlCommand1.Parameters[“”@Total””].Value.ToString(); statement will retrieve the value of the @Total parameter, convert it to a string value, and set the string value for the Text property of Label1. The Text property of the Label control specifies the text content of the control.
  • The Fill method of the SqlDataAdapter class is used to add or refresh rows in a DataSet to match rows in the data source. This method can also be used to populate a DataSet object.
  • The SqlDataReader class avoids creating unnecessary objects or making unnecessary copies of data. Hence, it provides optimal performance.
  • The Find method of the DataView object is used to find a row in a DataView object on the basis of the specified sort key value.
  • The XmlNode class is used to represent a single node in the XML document. The OuterXml property of the XmlNode class is used to retrieve the markup representing an XML node and its children nodes.
  • The DataRelation class is used to relate two DataTable objects to each other through DataColumn objects.
  • The following are the appropriate conditions on the basis of which the referential integrity rules are applied:
    • When changes such as edit or deletion are made in the Customer table records.
    • When changes made in the Customer table are either accepted or rejected.
    • When new records are added to a Customer table.
  • The OleDbConnection class represents an open connection to a data source. It is used to represent a unique session to an OLE DB data source, or to a Microsoft SQL Server 6.x database or earlier. It also represents a stored procedure or a SQL statement to execute at a data source.
  • The ExecuteScalar method of the SqlCommand class is used to execute a query against a data source. It returns the first column of the first row in the resultset returned by the query. It is commonly used to execute aggregate functions such as COUNT, SUM, etc., on a table.
  • The Close method of the SqlConnection class closes the connection to the database. This method can be called more than once by an application.
  • The Finalize method of the SqlConnection class performs cleanup operations before the object is reclaimed by garbage collection. There is no guarantee of the resources being released at a particular time, unless the Dispose or Close method is called.
  • In the Dataset1.Tables[“”Table1″”].Rows[2].Item[“”Name””]; statement, the Tables collection with the parameter value Table1 specifies the table from which data is to be accessed. The Rows collection is used to specify the record to be accessed. The element index of the Rows collection starts with 0. The Item collection with the parameter value Name specifies the name of the field from which data is to be accessed.
  • The CommandText property of the OleDbCommand class is used to get or set the stored procedure or SQL statement that is to be executed at the data source.
  • The Connection property of the OleDbCommand class is used to get or set the OleDbConnection that is used by an instance of the OleDbCommand class.
  • The Prepare method of the SqlCommand class is used to create a prepared version of the command on an instance of SQL Server. This method prepares a compiled version of the command on the data source.
  • The CommandType property specifies how the command string is interpreted.
  • The SqlParameter constructor accepts two parameters, parameter name and its datatype. Once the SqlParameter object is created, its direction is specified.
  • The Repeater control is a data-bound list control that allows custom layout by repeating a specified template for each item displayed in the list. It does not have built-in layout or styles.
  • The RowFilter property of the DataView class is used to get or set the expression to filter the rows that are to be viewed in a DataView object. The expression for the RowFilter property includes a column name defined in a database table, an operator, and a value to filter on. The expression should be enclosed in double quotes.
  • By setting the CommandType property of the SqlCommand class to StoredProcedure causes the command to be interpreted as the name of the stored procedure rather than a SQL statement. The default value of this property is CommandType.Text.
  • The Direction property of the SqlParameter class is used to get or set a value, which indicates the type of a parameter. A parameter can be input-only, output-only, bi-directional, or a stored procedure return value parameter.
  • A stored procedure is a group of Transact-SQL statements compiled into a single execution plan. It provides better performance, as a fully compiled execution plan is created and retained in the SQL Server procedure cache.
  • The ExecuteScalar method of the SqlCommand class is used to execute the command, as only a single value is to be retrieved from the database.
  • The Read method of the SqlDataReader class advances the SqlDataReader object to the next record if the next record exists. It returns true if another record exists. Otherwise, it returns false. The default position of the SqlDataReader object is prior to the first record.
  • The SQL Server database version 6.5 can be upgraded to later version in order to improve performance of program code.
  • The GROUP BY clause groups selected rows on the basis of values of specified column or columns for each row and returns a single row of summary information for each group. It does not guarantee the order of the result set. Therefore, an ORDER BY clause should be used with the GROUP BY clause to sort the result set in the desired order.
  • In AssessmentText.Text = (string)comm.Parameters[“”@AssessmentResult””].Value; statement, the Value property of the SqlCommand class is used to retrieve the value of a specified output parameter. The (string) typecast in the code segment ensures that the value of the output parameter is a string before assigning its value to the Text property of the AssessmentText text box control.
  • A stored procedure is a group of Transact-SQL statements compiled into a single execution plan. It can be used to implement business logic or as a security mechanism, but it is not executed automatically.
  • The INNER JOIN produces only the matching rows from both the tables.
  • Left outer join produces all records from the left table with the matching records from the joined table.
  • The ReadXml method of the DataSet class reads XML schema and data into a DataSet.
  • The ExecuteXmlReader method of the DataSet class builds the XmlReader object.
  • The Merge method of the DataSet class incorporates the latest changes from a data source into an existing DataSet object.
  • The XmlDocument class represents the top node of an XML document.
  • The XmlReader class defines properties that are used to retrieve information about the name and content of the current node.
  • The System.Threading namespace provides interfaces and classes that enable multithreaded programming in XML.
  • The LineNumber property that is inherited from the XmlSchemaObject class, specifies the line number referred to by a schema element in a file.
  • An XML document must have only one top-level element known as document element or root element. Each element must have both a start tag and an end tag.
  • An XML document consists of two main parts, namely prolog and document.
  • The Regsvcs.exe tool is used to load and register assemblies as well as generate, register, and install a type library into a COM application.
  • The DeleteRule property of the ForeignKeyConstraint class is used to specify the action that is to occur when a row is deleted.
  • To normalize data and apply indexes on the tables in a database is to improve the application’s performance.
  • The XPathDocument class is used to provide fast and read-only cache for XSLT processing and XPath data model.
  • The OnItemDataBound method of the DataGrid control is used to raise the ItemDataBound event that occurs after a data item is bound to the control.
  • The ConnectionString property of the SqlConnection class is used to connect to a data source.
  • The Load method of the XmlDocument class is used to load the contents of an XML file into an XmlDocument object.
  • The ExecuteScalar method of the SqlCommand class is used to execute query commands that return a single value such as an average from a data source irrespective of the number of rows actually selected.
  • The AutoGenerateColumns property is used to get or set a value that indicates whether or not the BoundColumns object are automatically created and displayed in the DataGrid control for each field in a data source.
  • The Clone method is used to copy the structure of the DataTable. It includes schemas and constraints, but it does not include the DataRow of a DataTable object.
  • The DataReader class is used to retrieve a read-only and forward-only stream of data. It optimizes the performance of an application because only one row at a time remains in the memory.
  • SQL Server 2000 supports the FOR XML clause with the SELECT statement. The FOR XML clause instructs the SELECT statement to return the query result in an XML format instead of a tabular format.
  • The PermitOnly method is inherited from the CodeAccessPermission class. It is used to prevent callers higher in the call stack from using the code that calls this method to access resources that are not specified by the current instance.
  • The xml data type is a built-in data type in SQL Server 2005. As with other built-in data types such as int and varchar, a user can define the xml data type on a column when he creates a table.
  • The Transform method of the XslTransform class is used to transform XML data using an XSLT, and returns the results into a Stream. The Response.OutputStream argument is used to enable the output to the outgoing HTTP response stream.
  • The following are the approaches to synchronize data1 with XmlData1:
    • To populate a DataSet object with data and its schema and then to synchronize it with an XmlDataDocument object.
    • To populate a DataSet object with a data schema such as a strongly typed DataSet and then to synchronize it with an XmlDataDocument object.
    • To create a new XmlDataDocument object and load it from an XML document.
  • The GetChanges method of the DataSet class returns a copy of the DataSet, containing all changes made to the DataSet since it was last loaded, or since the AcceptChanges method was last called.
  • The FileIOPermission class is used to control the ability to access files and folders. The PermitOnly method is used to prevent callers higher in the call stack from using the code that calls a method to access resources that are not specified by the current instance.
  • The DataColumn Sal = new DataColumn(“”BasicSalary””, Type.GetType(“”System.Decimal””)); statement will create a column, named BasicSalary, which has the Decimal datatype.
  • The DataTable1.Columns.Add(Sal); statement will add the new column in DataTable1.
  • The Expression property of the DataColumn class creates an aggregate column. It can be used to calculate values in a column or filter records.
  • The Commit, Rollback, and Save methods are defined in the SqlTransaction class.
  • The Save method of the XmlDocument class is used to save an XML document to a specified file or location.
  • The GetChildRows method of the DataRow class is used to get the child rows of a DataRow object.
  • The CommandText property of the SqlCommand class specifies the stored procedure or SQL statement that is to be executed at the data source. The Parameters.Add method adds a SqlParameter to the SqlParameterCollection.
  • The SqlCommand class represents a Transact-SQL statement or stored procedure to be executed at a SQL Server database.
  • The XmlNode class is used to represent a single node in the XML document. The OuterXml property of the XmlNode class is used to retrieve the markup representing an XML node and its children nodes.
  • The Read method of the SqlDataReader class advances the data reader to the next result. It returns true if there are more results to be returned, otherwise it returns false.
  • The XmlNode class derived from the System.Xml namespace is a representation of a single node in an XML document. It is the base class in the XML DOM, and supports XPath selections and provides editing capabilities.
  • The Merge method of the DataSet class is used to incorporate the latest changes from a data source into an existing DataSet object.
  • The WriteXml method of the DataSet class is used to write XML schema and data from a DataSet object in XML format.
  • The ErrorPage attribute of the @ Page directive specifies an error page whenever any unhandled exception occurs in an .aspx page. However, it is always better to handle an exception by using the try catch block.
  • The Inherits attribute of the @ Page directive defines a code-behind class from which the generated class inherits.
  • The EditCommand event of the DataGrid control occurs when users click the Edit button for a DataGrid item.
  • The EditItemIndex property of the DataGrid control specifies the index of an item in the DataGrid control to edit. It is used to programmatically control which item is being edited.
  • The ItemDataBound event is raised after an item is data bound to a DataGrid control.
  • The TextChanged event of a TextBox control occurs when the content in the text box is changed upon server postback.
  • The Load method of the XmlDocument class is used to load the contents of an XML file into an XmlDocument object. It always preserves significant white space. It does not perform document type definition (DTD) or schema validation.
  • The XmlDocument class that defines within the System.Xml namespace is used to represent an XML document.
  • The Clone method of the DataSet class clones the DataSet structure containing DataTable schemas, constraints, and relations. It does not copy data from a DataSet object.
  • A constructor of the DataRelation class is used to create a DataRelation object that represents the parent/child relationship between two tables.
  • The Fill method of the DbDataAdapter class is used to add rows in a DataSet to match those in a data source.
  • The ConnectionTimeout property of the System.EnterpriseServices namespace is used to represent a connection to a datasource. This property should be used for an application to respond quickly in a few seconds.
  • The ImportNode method of the XmlDocument class is used to import the node from another XML document.
  • The SqlConnection class represents an open connection to a SQL Server database. ADO.NET supports connection pooling where the SqlConnection class is used to increase the performance of the application.
  • The WriteXmlSchema method of the DataSet class creates an XML Schema Definition (XSD) file from the DataSet object. It writes the DataSet structure as an XML Schema.
  • The SqlConnection.BeginTransaction method starts a database transaction.
  • The SqlTransaction.Connection property returns a SqlConnection object in association with a transaction that can take place for each new database connection.
  • The GetErrors method of the DataTable class returns an array of DataRow objects that have errors.
  • The DataTable.HasErrors property returns a value that specifies whether any error exists in any rows of the data table.
  • The AutoIncrement property of the DataColumn class sets a value to indicate whether or not the value of the column is automatically incremented for new rows to be added to the table. The AutoIncrementSeed property sets the starting value for a column only if the AutoIncrement property is set to true. The AutoIncrementStep property of the DataColumn class sets the number by which the value of the column is to be automatically incremented. The default value of this property is 1.
  • The Connection Timeout parameter of the ConnectionString property specifies the time period (in seconds) required to wait for a connection to the server.
  • The Max Pool Size parameter of the ConnectionString property determines the maximum number of connections allowed in the connection pool.
  • The IDataAdapter interface allows an object to implement the DataAdapter class.
  • The AllowDBNull property of the DataColumn class returns a value to indicate whether null values are allowed in the column to retrieve specified data records.
  • An InvalidCastException is thrown when a user tries to load data that does not match the datatype specified for the column.
  • The SoapException class is used to throw SoapException when an XML Web service method is called over SOAP and an exception occurs.
  • The SqlError class collects warning-related or error-related information returned by the SQL Server database.

Testing and Debugging

  • During unit testing, a developer takes the smallest unit of an application, isolates it from the rest of the application code, and tests it to determine whether it works as expected.
  • The following are the advantages of Unit testing:
    • A large percentage of defects can be identified during the process of Unit testing.
    • It enhances the process of testing, as the elementary units of the application are tested separately.
    • It reduces the cost of testing, as small special programs such as test drivers and stubs can be reused during the whole process of testing.
    • It also simplifies the process of debugging, as it limits the search for errors to a small unit of the application, instead of searching the whole of the application.
  • The Regression testing is used to make sure that no new errors are found in an application. It can be performed any time when a program needs to be modified either to add a feature or to fix an error.
  • Testing a software aims at fulfilling each and every requirement specified in the software specification. A test plan can be defined as a formal document that guarantees that the software has been tested thoroughly, meets user requirements, and has no defects.
  • The WriteLineIf method is used to write information to the trace listeners with a new line character if a condition is true.
  • ASP.NET controls the enabling or disabling of tracing both at the page-level and at the application-level.
  • A try block must be accompanied by at least one catch block or one finally block.
  • The Assert method of the Trace class checks for a condition and displays a message if the condition is false.
  • The DefaultTraceListener class is automatically included in the Listeners collection. Its default function is to output debugging or tracing messages, such as Write and WriteLine messages to the OutputDebugString function and to the Debugger.Log method that appear in the output window.
  • The TraceSwitch class provides a multilevel switch to control trace and debug output. It does not require recompiling the code. It can be used to specify whether or not tracing occurs in the application code.
  • The element of the application’s Web.config file is used to ensure that the trace output is appended to the bottom of each page.
  • Tracing can be enabled or disabled for a page by using the Trace attribute of the @ Page directive. It can be enabled for an application by using the element in the application’s Web.config file.
  • The TraceContext class provides the Write and Warn methods. Both the methods are used to write statements to the trace log. Messages written by the Warn method are displayed in red, whereas those written by the Write method are displayed in black.
  • The <customErrors> element of the Web.config file provides information about custom error messages for ASP.NET applications. The mode attribute of the element is used to specify whether custom errors are enabled, disabled, or shown only to remote clients.
  • Trace.axd is an Http Handler that can be used to view the trace details for an application. This file resides in the application’s root directory. A request to this file through a browser displays the trace log of the last n requests in time-order, where n is an integer determined by the value set by requestLimit=””[n]”” in the application’s configuration file.
  • A client-activated .NET Remoting object is created to ensure that an object logs error and warning messages to a log file and Windows application log.
  • The Trace.axd Http handler is used to view the trace details of an application by setting the value of requestLimit=””[n]”” in the application’s configuration file.
  • The Assert method of the Trace class is used to check for a condition and displays a message if the condition is false.
  • The Fail method of the Trace class emits an error message unconditionally.
  • The TraceError property of the TraceSwitch class returns true if Level is set to Error, Warning, Info, or Verbose; otherwise it returns false.
  • The TraceWarning property of the TraceSwitch class returns true if Level is set to Warning, Info, or Verbose; otherwise it returns false.
  • The pageOutput attribute of the @ Page directive sets the value to true if the trace information is displayed both on an application’s pages and in the .axd trace utility, otherwise it sets the value to false.
  • Use the WriteLineIf() method of the Debug class to write a message with a new line character to the trace listeners in the Listeners collection if a condition is true.
  • Displaying output tracing messages by implementing the Log() method of the Debugger class.
  • The Watch window is a debugging window that displays the current watch expressions, whose values are to be monitored as the code runs. This window can display a value for a watch expression only if the current statement is in the specified context. It is used to see the values of variables within different scopes, i.e., module level, procedure level, and global variables.
  • The Locals debugging window displays the value of variables within the scope of the current procedure.
  • The Configuration property generates a program database file (.pdb) that contains information about symbols used within the application on compiling the project. It also lets breakpoints invoke on debugging.
  • The EventLogTraceListener class provides a listener that directs debugging or tracing output to an EventLog.
  • The Output debugging window is used to display status messages at runtime. It also displays output that results from debugging instructions placed in the application code. The content of the Output window is cleared each time the application is compiled or run.
  • The CreateEventSource method of the EventLog class creates an event if the event log does not already exist and register a Web service with this event log.
  • The Data breakpoint breaks the execution of the program and causes the program to change the value of a variable available in the source code of an application.
  • The Cordbg.exe tool is used to debug the application from a command prompt. It provides command-line debugging services. It also helps to find and fix bugs in programs that target the .NET Framework common language runtime.
  • The Call Stack debugging window is used for viewing the list of currently active procedure calls during break mode.
  • In order to resolve the issue of the logical error that had occurred in the Web form, the program is executed step-by-step to get the exact location of the error. Breakpoints are used in the code to analyze why the code is generating errors.

Deploying a Web Application

  • Installation packages are created for deploying a Web application by using a Web Setup project. A merge module project is used for components to be added to the application.
  • The following are the various features of .NET deployment:
    • By default, multiple applications do not share components.
    • Multiple applications need to explicitly make the components available for sharing by assigning a strong name to an assembly.
    • No-impact applications isolate an application and remove DLL conflicts.
    • Private components have no impact on other applications.
    • Side-by-side versioning deploys multiple versions of a component or an application.
  • The common language runtime finds the assembly through the codebase setting. If no match is found in the location as specified in the element in the application configuration file, the binding request fails. Then the CLR tries to find the assembly through probing.
  • The File System Editor is used to add project outputs and files to a deployment project.
  • The Parent property of the Installer class is used to set the current installation to a collection of installers.
  • The Windows Explorer allows installation and uninstallation of assemblies in the Global Assembly Cache by using drag and drop and menu operations.
  • Only users with Administrator privileges can delete files from global assembly cache (GAC). GAC provides side-by-side versioning by storing multiple copies of assemblies.
  • The common language runtime or CLR differentiates between the assemblies on the basis of the culture specified at compile time with Al.exe’s culture attribute, and each assembly’s directory location.
  • The Web Setup project and Deployment project is used to create installation packages for the deployment of Web-based applications such as XML Web services, Web applications etc., to a Web server.
  • The .NET Framework allows sharing of an assembly among multiple applications. Such an assembly is called shared assembly. All assemblies stored in global assembly cache must have strong names.
  • The Al.exe (Assembly Linker) tool is used to compile a satellite assembly.
  • The Installutil.exe tool can be used to install multiple assemblies at a time. It performs installation in a transactional manner.
  • The Resgen.exe tool can be used to perform the following tasks:
    • Convert .txt files to .resources or .resx files.
    • Convert .resx files to .txt or .resources files.
    • Convert .resources files to .txt or .resx files.
  • For deploying shared assemblies, the binding policy that is a set of rules determines the place to search for the assembly and version to bind to the application. The searching process of the CLR involves the following three stages of the binding policy resolution:
    • Application policy resolution
    • Publisher policy resolution
    • Administrator policy resolution
  • The following are the steps that determine the correct version of an assembly:
    • The CLR examines the application configuration file.
    • It examines the publisher policy file.
    • It examines the machine configuration file.
  • The Sn.exe tool is used to sign assemblies with strong names. It also provides signature generation, signature verification, and key management.
  • The Signcode.exe tool is used to sign a portable executable file for a component or an assembly with an Authenticode digital signature.

Maintaining and Supporting a Web Application

  • The TraceMode attribute of the @ Page directive specifies the order in which the trace information is to be displayed. It can be sorted either by the Category column (SortByCategory) or by time column (SortByTime).
  • A XML Web service is used to open wire formats to communicate between different systems. Open wire formats are the protocols that support common Web standards, such as HTTP and SOAP.
  • The output caching technique allows subsequent requests for a particular page to be satisfied from the cache, instead of executing code that initially creates the page each time the page is requested. Caching a Web site’s most frequently accessed pages can improve the performance of the Web site.

Configuring and Securing a Web Application

  • To set the login and password authorization for users, the forms-based authentication is enabled in the Web.config file.
  • Anonymous users will be denied from accessing the site by making necessary changes in the Web.config file. They can be authenticated by allowing them to enter credential information in a login page.
  • The allowOverride attribute of the element specifies whether or not the configuration settings in child directories are overridden by configuration settings in the Web.config file.
  • The Duration attribute of the @ OutputCache directive specifies the amount of time (in seconds) for which a control is cached.
  • The VaryByParam attribute allows developers to vary the output cache depending on a GET query string or form POST parameters.
  • The configuration system used by ASP.NET is case-sensitive. All single word configuration sections are written using lowercase letters. For example, trace is correct, but Trace will cause a parser error. On the other hand, sections or attributes whose names are a combination of two words must be camel-cased. For example, requestLimit and pageOutput are correct, but requestlimit or pageoutput will cause a parser error.
  • The users attribute of the <allow> element specifies the user names that are allowed access to a resource. The users attribute of the <deny> element specifies the user names that are denied access to a resource. By setting this attribute to “”?”” denies anonymous or unauthorized users from accessing the application.
  • The Windows NT ChallengeResponse authentication provides the highest security. It uses a cryptographic exchange of passwords in encrypted form instead of transmitting them as clear text on the Internet.
  • Basic authentication is used to authenticate users on the Internet and enables a browser to prompt the user for a username and password.
  • The Passport authentication enables users to be redirected to a Passport site where they are authenticated. After successful authentication, they are redirected to the original site.
  • When cookieless forms authentication is used, the CookieMode property is set to one of the values of the HttpCookieMode enumeration.
  • The SecurityAction enumeration is used to specify the security actions that can be performed by using declarative security. Declarative security check is a security check performed on the declarative information in metadata.
  • The SecurityAction.RequestMinimum value is used to request for the minimum permissions required for code to run.
  • The loginUrl attribute of the element is used to specify the URL to which the request will be redirected for logon if no valid authentication cookie is found.
  • The <authorization> element is used to configure ASP.NET authorization support. It contains <allow> and <deny> sub elements. These sub elements are used to allow or deny access to a resource based on specific users or roles.
  • The roles attribute of the <allow> or <deny> element is used to specify a comma-separated list of roles that are granted or denied access to a resource.
  • The timeout attribute of authentication specifies an integer value that denotes the time (in minutes). The slidingExpiration attribute of authentication specifies that the session timeout is periodically reset as long as a user stays active on the site.
  • In the Packet Privacy authentication level, authentication and encryption of data are performed. This level includes data integrity and the identity and signature of a user.
  • Anonymous authentication method establishes a Web connection to the IIS server without providing a username and password.
  • The Microsoft Passport service is an online service that is used by the Passport authentication provider for user authentication. The passport to indicate authenticated users uses an encrypted mechanism.
  • The Custom Authentication with SOAP headers is suitable for both secure and nonsecure Internet scenarios. For user authentication, the user credentials in encrypted format are passed within the SOAP header of the SOAP message.
  • Authorization determines whether or not a principal is allowed to perform a requested action.
  • The impersonate attribute of the <identity> element specifies whether or not client impersonation is used on each request.
  • The FileAuthorizationModule module is used when the authentication mode attribute is set to Windows in the element and checks against the access control list (ACL).
  • The username and password attributes is specified in the <identity> element of the Web.config file for every request on a Web page.
  • The GenericPrincipal class represents a generic principal. The GenericIdentity class represents a generic identity. Both these classes are used in conjunction with each other to create an authorization scheme. These classes can be used to prompt users for their user names and passwords, to check these values against a database, and to create principal and identity objects.
  • The IsSubSetOf method of the PrincipalPermission class is used to determine whether or not the current permission object is a subset of the specified permission object.
  • Code-access security is a security mechanism that determines whether .NET code is authorized to access a protected resource or not.
  • The IsInRole method of the WindowsPrincipal class is used to determine whether or not the current principal belongs to a specified Windows user group.
  • The PrincipalPermissionAttribute attribute applies to a class or method in order to declaratively demand for those users who belong to a specified role or have been authenticated.
  • The Union method of the PrincipalPermission class is used to create a permission object that is the union of the current permission object and a target parameter permission object.
  • The Windows authentication provider authenticates users on the basis of their Windows accounts.
  • The VaryByParam attribute of the @ OutputCache directive is used to vary user control output cache by specifying user control name and parameter.
  • The Cache object implements the cache for a Web application. The Session object pertains to an individual user’s session with an application. It is used to store and retrieve information during a specific session for a user.
  • The SetVaryByCustom method of the HttpCachePolicy class is used to specify a custom text string to vary the cached output responses.
  • The @ OutputCache directive controls the output caching policies of an ASP.NET page or a user control contained in an ASP.NET page.
  • The Duration and VaryByParam attributes is used in the @ OutputCache directive so that a parser error does not occur when a Web page is first requested.
  • To cache portions of a Web page, the objects or data associated with the Web page request that require significant server resources to construct are identified. Items are then created as separate Web user controls. In this way, these items are isolated from the rest of the page. Caching these items for a specific period of time will save the server resources.
  • An array of data containing user’s session is created and the Session object is used for data storage. If the Session object is enabled, only users of a particular session will be redirected to other Web pages to view them.
  • By setting the SessionStateMode to StateServer indicates that the session state is stored on a remote server.
  • A session cookie can be used as a user preference so that important information of a Web site is provided to users.
  • The Type class is used to represent type declarations, such as interface types, class types, value types, and enumeration types. etc.
  • The GetType method of the Type class is used to get the Type with the specified name.
  • The GetLastError method of the Server object is used to retrieve the previous exception.
  • The mode=””InProc”” attribute is used in the element of the application’s Web.config file to configure the session state settings for an application.