Creating User Services

  • The SessionID property of the HttpSessionState class identifies an active ASP.NET session by using a unique session ID.
  • The CodeBehind attribute specifies the name of the compiled file that contains the class associated with the page.
  • 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 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.
  • A Web page can be converted to a user control via code by the following manner:
    1. Change the extension of the Web page from .aspx to .ascx.
    2. Create an @ Control directive at the top of the page, instead of an @ Page directive.
    3. 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.
  • 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.
  • The RepeatColumns property specifies the number of columns to be displayed.
  • 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.
  • TemplateColumn is a column type to allow custom controls in a column of a table.
  • A Web user control creates the control using the same technique, which is used in the creation of Web form pages.
  • Several RadioButton controls on a Web form do not automatically interact with each other. In order to let them 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 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. This text is displayed in the Image control when the image specified by the ImageUrl property is not available.
  • The ApplyStyle method of the WebControl class applies any non-blank elements of the specified style to a Web control. It also overwrites the existing style elements of the control.
  • ASP.NET controls the settings of sub-properties by specifying a “”-“” special syntax. The “”-“” syntax between an attribute and a property denotes a sub-property.
  • 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 a server will occur whenever the content of a text box is changed.
  • 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.
  • The HttpServerUtility class defines two overloaded versions of the Transfer method. Their signatures are given below:
    1. Overloads Public Sub Transfer (String)
    2. Overloads Public Sub Transfer (String, Boolean)
  • The Transfer method of the HttpServerUtility class terminates execution of the current page and begins execution of a new page.
  • 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.
  • 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.
  • The IsValid property of the BaseValidator class is used to set a value to indicate whether or not the associated input control passes validation. The default value of this property is true.
  • The InitialValue property of a RequiredFieldValidator control is used to specify the initial value of the input control that is associated with the RequiredFieldValidator control.
  • 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.
  • The ControlToValidate property of a validation control is used to specify the input control that is to be validated.
  • The RequiredFieldValidator validation control is used to check whether an input control contains a value. It is generally used to validate a TextBox control.
  • 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.
  • If an error occurs on executing a stored procedure, a SQL Server returns an error or warning. This raises an exception of type SqlException.
  • If the Option Explicit mode is true, it is mandatory to declare all the variables used in the code.
  • 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 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 an error.
  • The State property of the SqlConnection class returns the current state of a connection.
  • The DataSource property of the SqlConnection class returns the name of the SQL Server to which an application is to be connected.
  • 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.
  • The AlternateText property of the Image class specifies an alternate text to be displayed in the Image control if the browser does not support the ToolTip feature or the image is unavailable.
  • The Transform method of the XslTransform class is used to transform XML data using an XSLT, and returns the results into a Stream.
  • 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 ReadXml method of the DataSet class reads XML schema and data into a DataSet using a specified file and XmlReadMode.
  • 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.
  • 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.
  • The <types> section of the WSDL file defines data types and data structures used by a Web service.
  • 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 EnableSession property of the WebMethodAttribute class is used to enable session state for an XML Web service method.
  • The Status property of the ServiceController class specifies the status of the current instance of a Windows service.
  • The IsCallerInRole method of the ContextUtil class determines whether the client is having the specific role or not.
  • 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 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 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.
  • The IsPostBack property of the Page class gets a value indicating whether the page is being loaded in response to a client postback or is being loaded and accessed for the first time.
  • The DayOfWeek enumeration represents day of the week in calendars that have seven days per week. It ranges from zero to six, i.e., from Sunday to Saturday.
  • The EnableViewState attribute of a control indicates whether or not the view state is maintained across page requests.
  • The AutoPostBack attribute of a control specifies whether or not an automatic postback to the server will occur whenever a user changes the content of a text box.
  • 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. 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 be edited. It is used to programmatically control which item is being edited.
  • The SelectedIndexChanged event of a ListBox control occurs when the selection on a list changes and is posted back to the server.
  • The SelectionMode property of a ListBox control is used to get or set the selection mode of the ListBox control. Setting this property to Single ensures that users can select only a single product at a time.
  • The IsWeekend property of the CalendarDay class is used to determine whether the date represented by an instance of this class is either Saturday or Sunday.
  • 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.
  • The BufferOutput property of the Response class specifies a value indicating whether or not to buffer output and send it after the entire page is processed.
  • The Flush method of the Response class sends all currently buffered output to the client.
  • 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

  • Resgen.exe (Resource File Generator) is a tool used to convert text (.txt) files and XML-based resource format (.resx) files to common language runtime binary .resources files, or vice versa.
  • Assembly Linker (Al.exe) is a tool used to generate a file with an assembly manifest from one or more files. These files are either resource files or modules.
  • Assembly Registration (Regasm.exe) tool is used to read the metadata within an assembly. Once a class is registered using the tool, 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.
  • 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 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.
  • Web custom controls are compiled components that run on the server. They encapsulate user-interface and other related functionality into reusable packages.

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.
  • When an array in Visual Basic .NET is declared, only the upper bound of the array is defined.
  • The Dataset1.Tables(“”Table1″”).Rows(2).Item(“”Name””) statement will retrieve data from the third record of the Name field in Table1.
  • The Database property of the OleDbConnection class is used to get the name of the current database.
  • The RowFilter property of the DataView class is used to get or set an expression to filter the rows to be viewed in a DataView object.
  • When the Serializable value of the IsolationLevel enumeration is specified, it prevents more than one user from updating the dataset until the transaction is complete.
  • The Expression property of the DataColumn class is used to create an aggregate column. It is used to calculate values in a column or filter records.
  • The AllowNew property of the DataView class is used to add new rows in a control such as the DataView control.
  • The Delete method of the DataView class is used to delete a row at a specified index.
  • The DataSet and DataRelation objects are used to create a relationship between these two databases to retrieve records.
  • The SqlDataReader object is used to store the return results from a procedure call.
  • A DataRelation object relates two DataTable objects to each other through DataColumn objects. It can be accessed through the Relations property of the DataSet object.
  • The AcceptChanges method of the DataTable class commits all changes made to a table since the method was last called. This method should be used after the updates have been made to the data set.
  • 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 class represents a stored procedure or a SQL statement to execute at a data source.
  • The Min Pool Size value of the ConnectionString property of the SqlConnection class is used to specify the minimum number of connections allowed in a pool.
  • The IndexOf method can be used to search for a string from the beginning.
  • The ExecuteScalar method of the SqlCommand class is used to execute a query. It retrieves the first column of the first row in a result set.
  • The SqlCommand class represents a stored procedure or a SQL statement to execute at a SQL Server database.
  • The CommandType property of the SqlCommand class specifies how the command string is interpreted.
  • 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 Precision property of the SqlParameter class is used to get or set the maximum number of digits that are used to represent the Value property.
  • Setting the SET ROWCOUNT command in a Transact-SQL statement will cause a query to stop processing when a certain number of rows are to be retrieved and when data modification statements such as INSERT, UPDATE, and DELETE are written in an application.
  • 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 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 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 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 Clear and ClearContent methods of the Response object clear all content output from the buffer stream.
  • The following are the appropriate conditions on the basis of which the referential integrity rules are applied:
    1. When changes such as edit or deletion are made in a table record
    2. When changes made in a table are either accepted or rejected
    3. When new records are added to a table
  • The LIKE operator is used to determine whether or not a given string matches the specified pattern. It can be used in a search condition to search for patterns. Wildcard characters can be used with the LIKE operator to substitute one or more characters in a search string.
  • 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.
  • The OleDbCommand class represents a stored procedure or a SQL statement to execute at a data source.
  • The AllowDBNull property is used to set restrictions on the column of a table. It is used to restrict the null values in a particular column, if its value is set to false.
  • The ExecuteScalar method of the SqlCommand class is commonly used to execute aggregate functions such as COUNT, SUM, etc., on a table.
  • 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.
  • The RowStateFilter property displays only the modified records in a DataView object.
  • 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 two 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 is used to incorporate the latest changes from a data source into the 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 GetChanges method of the DataSet class returns a copy of the DataSet. It contains all changes made to the DataSet since it was last loaded or since the AcceptChanges method was called.
  • The ExecuteNonQuery method of the OleDbCommand class is used to execute commands that do not return a value but change a database.
  • The SqlDataAdapter class is used to select, update, or delete data from a table. It does not create a table.
  • 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 ResetCommandTimeout method of the SqlCommand class is used to set the CommandTimeout property to the default value, i.e., thirty seconds.
  • The DeleteRule property of the ForeignKeyConstraint class is used to specify the action that is to occur when a row is deleted.
  • 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. Setting this property to False will improve the performance of the application, as it will disable the view states.
  • The GetInt32 method receives the value from a specified column as a 32-bit int data type.
  • To normalize data and apply indexes on the tables in a database is to improve an application’s performance.
  • The EditItemIndex property of the DataGrid control is used to programmatically control which item is being edited.
  • 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 Item property of the SqlDataReader class returns the value of a column or a field in a specified table.
  • The ConnectionString property of the SqlConnection class is used to connect to a data source.
  • The SelectedItem property of the ListControl retrieves a selected item having the lowest index in the list control. The Value property specifies the value content of the selected list item.
  • The Contains method of the DataRelationCollection class determines whether or not the primary key column or columns of any row in a DataRowCollection object contains the specified value.
  • The Find method of the DataRelationCollection class obtains a specified row from a collection of DataRow objects.
  • 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 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 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.
  • 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.
  • 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 of the FileIOPermissionAccess class 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 proper approach to synchronize a DataSet object with an XmlDataDocument object is to first populate the DataSet object with data and then to synchronize it with the XmlDataDocument object.
  • When the ExecuteNonQuery method of the SqlCommand class executes a Transact-SQL statement, it returns an Integer data type.
  • The Commit, Rollback, and Save methods are defined in the SqlTransaction class.
  • The Load method of the XmlDocument class is used to load the contents of an XML file into an XmlDocument object. However, it does not perform document type definition (DTD) or schema validation.
  • 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 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 TextChanged event of a TextBox control occurs when the content in the text box is changed upon server postback.
  • The ExecuteNonQuery method of the SqlCommand class returns an integer value, which indicates the number of rows affected as a result of the execution of a SQL statement.
  • The XmlDocument class that defines within the System.Xml namespace is used to represent an XML document.
  • 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 <xs:key> element specifies that the field or column on which a key constraint is specified must have unique values and must contain no null values.
  • The <unique> element specifies that a value of an attribute or element must be unique within the specified scope.
  • The name attribute of the <unique> element defines the name of the unique element and must be unique within an identity constraint set.
  • The BeginTransaction method of the SqlConnection class starts a database transaction.
  • The Connection property of the SqlTransaction class returns a SqlConnection object in association with a transaction that can take place for each new database connection.
  • An XmlReader class is created to display the XML file from a database. The Read method is implemented in order to read data from the XML file.
  • 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.
  • If the Resume Next statement is executed in the error-handling routine of a procedure, execution returns to the statement after the call to another procedure.

Testing and Debugging

  • When an application is developed, it is required to ensure that the application is defect free and fulfills the requirements for which it was developed. Therefore, developers perform various levels of testing on an application.
  • The following are the advantages of Unit testing:
    1. A large percentage of defects can be identified during the process of Unit testing.
    2. It enhances the process of testing, as the elementary units of the application are tested separately.
    3. 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.
    4. 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.
  • 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 security policy levels in hierarchical order are Enterprise policy, Machine policy, User policy, and Application domain policy.
  • The TraceError property of the TraceSwitch class returns true if the trace level is set to Error, Warning, Info, or Verbose.
  • 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.
  • The Write method of the Trace class writes information about trace to the trace listeners in the Listeners collection.
  • The EventLogTraceListener class provides a listener that directs debugging or tracing output to an EventLog.
  • 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 <trace> 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.
  • Tracing can be enabled for an application by using the <trace> element in the application’s Web.config file.
  • The enabled attribute of the <trace> element specifies whether or not tracing is enabled for an application. By default, this attribute is set to false. Setting this attribute to true will enable tracing for the entire application.
  • ASP.NET uses the TraceContext class to store information about a request, its control hierarchy, and trace information.
  • The TraceContext class provides the Write and Warn methods. Both the methods are used to write statements to the trace log.
  • The <customErrors> element of the Web.config file provides information about custom error messages for ASP.NET applications.
  • The mode attribute of the <customErrors> element is used to specify whether custom errors are enabled, disabled, or shown only to remote clients.
  • The Call Stack debugging window displays a list of currently active procedure calls during break mode.
  • 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 Warn method of the TraceContext class writes warning messages in red color to the trace log.
  • The Write method of the TraceContext class writes trace messages (excluding warning messages) in black color to the trace log.
  • The pageOutput attribute 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.
  • 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 Locals window is a debugging window and its contents change to reflect only the variables applicable to the current procedure. Global variables and variables in other projects are not accessible from this window.
  • The QuickWatch dialog box is used to quickly examine and evaluate variables and expressions for debugging.
  • The Output debugging window displays status messages at runtime. Its content is cleared each time the application is compiled or run.
  • A breakpoint specifies a line in a method or sub procedure at which Visual Studio .NET automatically suspends execution.
  • The script debugging can be enabled by taking the following steps:
    1. In Internet Explorer, click the Tools > Internet Options menu.
    2. Click the Advanced tab.
    3. Under the Browsing category, uncheck the Disable script debugging checkbox.
  • A breakpoint is a location in an application at which the execution of the application pauses temporarily. When an application encounters a breakpoint, it enters into break mode. A user can remove all the breakpoints in a solution at once by selecting Clear All Breakpoints from the Debug menu.
  • The <compilation> element of the Web.config file is used to configure compilation settings of ASP.NET.
  • The Watch window is used to see the values of variables within different scopes, i.e., module level, procedure level, and global variables.
  • 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 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 steps to debug the source code in the DLL file are as follows:
    1. Start the execution of a Web page.
    2. Attach a debugger to the process on which the Web page is running.
    3. Set a breakpoint in a method and then continue with the program execution.
    4. Execute the program in step mode from a particular breakpoint onwards.

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:
    1. By default, multiple applications do not share components.
    2. Multiple applications need to explicitly make the components available for sharing by assigning a strong name to an assembly.
    3. No-impact applications isolate an application and remove DLL conflicts.
    4. Private components have no impact on other applications.
    5. 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 <codebase> 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 utilities for the verification of the security policy for a deployed application are Caspol.exe, Preverify.exe, and Permview.exe.
  • 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:
    1. Convert .txt files to .resources or .resx files.
    2. Convert .resx files to .txt or .resources files.
    3. 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:
    1. Application policy resolution
    2. Publisher policy resolution
    3. Administrator policy resolution
  • The CLR determines the correct version of an assembly by examining the application configuration file, the publisher policy file, and the machine configuration file.
  • The Sn.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

  • 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.
  • A destructor is a special type of method used to destroy instances of a class when they are no longer used by an application. A destructor has the same name as the class in which it resides, preceded by a tilde (~) symbol.
  • 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.
  • The @ OutputCache directive controls the output caching policies of an ASP.NET page or a user control contained in an ASP.NET page.
  • Errors in the application can be avoided by the following:
    1. Responding to health monitoring events
    2. Using a debugger to the process in which the application is running
    3. Using a tracing feature

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.
  • 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.
  • The allowOverride attribute of the <location> 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 <customErrors> element provides information about custom error messages for ASP.NET applications.
  • The mode attribute of the <customErrors> element specifies whether custom errors are enabled, disabled, or shown only to remote clients.
  • The VaryByParam attribute of the @ OutputCache directive allows developers to vary the output cache depending on a GET query string or form POST parameters.
  • The <appSettings> element is a predefined configuration section of the .NET Framework, which contains custom application settings. Each element added to the <appSettings> element has a key attribute and a value attribute.
  • 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.
  • 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.
  • By setting the <users> attribute of the <authorization> element to “”?”” indicates that only anonymous users are allowed to access an application. By setting the <users> attribute to “”*”” is used to deny all users from accessing the application
  • When cookieless forms authentication is used, the CookieMode property is set to one of the values of the HttpCookieMode enumeration.
  • The SecurityAction.RequestMinimum value is used to request for the minimum permissions required for code to run.
  • 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 loginUrl attribute of the <forms> 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.
  • 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.
  • The <authentication> tag is used to configure ASP.NET authentication support.
  • Authorization determines whether or not a principal is allowed to perform a requested action.
  • 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.
  • The Union method of the PrincipalPermission class creates a permission that is the union of a permission object and a target parameter permission object. The Demand method determines at run time whether or not the current principal matches that of the permission object demanded.
  • 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 authentication 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 GetCurrent method of the WindowsIdentity class returns a WindowsIdentity object representing the current Windows user.
  • The IsInRole method of the WindowsPrincipal class is used to determine whether or not the current principal belongs to a specified Windows user group.
  • WindowsIdentity and WindowsPrincipal are the classes of the System.Security.Principal namespace. To use these classes without any error, the System.Security.Principal namespace needs to be imported.
  • The Windows authentication provider authenticates users on the basis of their Windows accounts.
  • Use the cache classes to implements the cache for a Web application and adds to the Cache object and when modified it should be added to Session object.
  • 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 are used in the @ OutputCache directive so that a parser error does not occur when a Web page is first requested.
  • 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.
  • A session cookie can be used as a user preference so that important information of a Web site is provided to users.
  • 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.

Comments are closed.