Creating User Services

  • The identity object of the IIdentity interface is used during the authentication process, when a user’s identity is verified. It contains information about a user who is being validated, such as username and password.
  • The principal object of the IPrincipal interface is used during the authentication process, when the application determines the data that can be accessed by a user and code to be executed. It contains information about a user’s identity, such as username and password, as well as information about a user’s role, such as manager or associate.
  • The correct sequence of the classes of the System.Windows.Forms namespace in descending order is as follows:
    1. Control
    2. ScrollableControl
    3. ContainerControl
    4. Forms
  • The MinimumSize property of the Form class is used to get or set the minimum size up to which a form can be resized.
  • The Size property of the Form class is used to get or set the size of a form.
  • Setting the MinimizeBox property of a Windows form to false prevents the minimize button from being displayed in the caption bar of the form.
  • Setting the MaximizeBox property of a Windows form to false prevents the maximize button from being displayed in the caption bar of the form.
  • Setting the FormBorderStyle property of a Windows form to one of the Fixed styles prevents the form from being resized.
  • The Dock property of a control specifies the edge of the parent container to which the control is to be docked.
  • The DockStyle enumeration specifies the position and manner in which a control is to be displayed.
  • The RightToLeft property of the Form class indicates whether or not the form elements should draw right-to-left for RTL languages.
  • The CreateControl method of a GroupBox control is used to force the creation of a copy of the control with all its child controls.
  • A base form can be designed with all the elements that are common in multiple forms. After using visual inheritance, the base form can be used as a template for all other forms.
  • Visual inheritance is a feature that allows the creation of a new form from an existing form.
  • In order to use the Inheritance Picker dialog box to create an inherited form, the project that contains the base form must be built into an executable file or DLL.
  • 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 top-level menu items can have the same access keys. If the same key is defined as an access key for more than one menu item, a user has to hold down the ALT key and the access key to move from one menu option to another.
  • The AccessibleName property of the Control class is used to get or set the accessible name of a control, which is reported to the accessibility aids. It contains a string value used by clients to identify, find, or announce a control for users.
  • The IsCheckable property of the MenuItem class is used first in a Windows form, as it returns a value to indicate whether or not a MenuItem can be checked. The IsChecked property of the MenuItem class is then used, as it sets or returns a value to indicate whether or not the MenuItem is checked when a user clicks on the menu item.
  • The steps to dynamically add a ListBox control to a Windows form and make it visible are as follows:
    1. Create an object of the control.
    2. Set the Visible property of the control to true at design time.
    3. Add the ListBox object to the Controls collection of the form.
  • Multiple events can share the same delegate type. Once a delegate type is declared for an event, the event is declared as a delegate type field.
  • The Anchor property of a control is used to define a consistent position of the control in its parent container. A control can be anchored to one or more edges of its container.
  • The AddRange method of the Control.ControlCollection class is used to add an array of controls to a collection. It is also used to add a single control to a collection.
  • The TextBox control added dynamically to a Windows form has the default height and width. By default, the Visible property of the TextBox control is set to true.
  • The following are the advantages of early binding:
    1. An object is created faster.
    2. Information about properties and methods of an object is available in design environment.
  • The CloneMenu method of the MenuItem class can be used to create copies of the specified menuitems.
  • Context menus or pop-up menus are shortcut menus that appear only when a user clicks the right mouse button over a control or a form. They are built using the ContextMenu class.
  • The TabStop property of a control indicates whether the control will receive focus as the user tabs through a window by using the TAB key.
  • The AcceptButton property of a form is used to set up an accept button for the form. An accept button for a form is one whose click event is triggered when a user presses the ENTER key in the application regardless of the position of the cursor on the window.
  • A key combination that a user presses for quick access to the actions that they perform frequently, is called a shortcut key or an accelerator key.
  • The Text property of the MenuItem class specifies the text to be displayed as the caption for a menu item. While specifying the Text property, an & character is used to access the key.
  • The try, catch, and finally are valid exception handling blocks in C# .NET.
  • If the CausesValidation property of a TextBox control is set to False, the Validating and Validated events are suppressed.
  • The MaxLength property of a TextBox control is used to specify the maximum number of characters that can be entered into the text box control.
  • The most specific catch block that can handle DirectoryNotFoundException is the one that handles IOException exception.
  • The SqlException exception is raised, if an error occurs on executing a stored procedure and SQL Server returns an error or warning.
  • The ErrorProvider control is used to provide a user interface for indicating whether or not a control has an error associated with it. Generally, it is used in association with data-bound controls.
  • The SetError method of the ErrorProvider control is used to specify the error description string for a specified control.
  • The GetHelpString method of the HelpProvider class is used to get the contents of the pop-up Help window for a specified control.
  • When the HelpProvider control is added to a Windows form, the HelpString, HelpNavigator, and HelpKeyword properties are also added to the form.
  • The Active property of a ToolTip control determines whether the ToolTip control is currently active or not.
  • The ToolTip control can be added to a form by using the Toolbox pane. The ToolTip component is a non-visual control. When it is added to a form, it appears in the component tray that is below the form.
  • The ExecuteXmlReader method of the DataSet class builds the XmlReader object.
  • LostFocus is an event of the Control class and occurs when a control loses input focus.
  • The AppendChild method of the the XmlAttribute class is used to add a specified node to the end of the list of child nodes, of the current node.
  • The SqlDataAdapter class represents a set of data commands and a database connection that are used to fill a DataSet and update a SQL Server database.
  • The SqlCommand class represents a transact-SQL statement or stored procedure to be executed at a SQL Server database. The SqlConnection class represents an open connection to a SQL Server database.
  • In a SingleCall object, a new object is created whenever a message arrives. The new object then processes the message and returns an optional reply. Finally, the object created is discarded.
  • For Marshal By Reference objects, a reference to an object is made when it is passed from one application to another.
  • 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.
  • The WaitHandle class represents synchronization objects in runtime. It is used by Windows Forms applications and ASP.NET Web Forms that need to finish all processing before sending a completely processed page back to the user’s browser.
  • The WaitAny method waits for the first Web service to return a result before allowing the method to continue processing.
  • 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 <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.
  • A Web Service is built of the following four different parts:
    1. The processing directive
    2. The namespace
    3. The public class
    4. The Web-callable methods
  • COM components can be used in applications by adding a reference to a type library.
  • In order to localize a Windows form, the Localizable property of the Form class must be set to true and the Language property of the Form class must be set to the language in which the form is developed.
  • When the AddHandler method is called, it will add a handler to an event handler collection.
  • The System.ComponentModel.CancelEventArgs class provides data for a cancelable event. The Cancel property of the class specifies whether or not an event of an object should be canceled.
  • To trigger the Click event of a Button control when users press the ESC key, the CancelButton property of a Windows form must be set to the name of the button.
  • The Select event of the MenuItem class is raised when a menu item is highlighted using a mouse or keyboard. This event can be used to set the help text for menu items.
  • A method bound to an event is known as an event handler. It executes when the associated event is raised.
  • The events of the Control class occur in the following order:
    1. Enter
    2. GotFocus
    3. Leave
    4. Validating
    5. Validated
    6. LostFocus
  • The Load event of the Form class occurs when a form is displayed for the first time. This event is used to perform tasks such as allocation of resources, initialization of variables, etc.
  • The Leave event of the TextBox control occurs when the input focus leaves the control.
  • The PrintPreviewControl displays a PrintDocument exactly as it would appear on printing. This control does not provide any button or other user interface elements.
  • The PageSettings property of the PrintPageEventArgs class is used to get the page settings of the current page.
  • The PrintPage event of the PrintDocument class occurs when a page is printed.
  • The HasMorePages property of the PrintPageEventArgs object specifies whether or not to print an additional page.
  • The PrintDialog control is a graphical interface that allows a user to select a printer and specify other print settings for an associated PrintDocument object. It is a non-visual control.
  • The AllowSelection property of a PrintDialog control returns a value to indicate whether or not the Selection option button is enabled when the Print dialog box is displayed.
  • The AllowSomePages property of a PrintDialog control returns a value to indicate whether the Pages option button is enabled or disabled when the Print dialog box is displayed.
  • The ChildKeyConstraint property of the DataRelation class is used to get the ForeignKeyConstraint for the relation established between two tables.

Creating and Managing Components and .NET Assemblies

  • The Timeout property of the HttpSessionState class sets the amount of time that needs to elapse, before the session state provider terminates the session.
  • The Publisher policy configuration file contains compatibility information issued by the publisher of a shared component. It ensures that the latest version of the shared component is used by all applications using the component.
  • 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.
  • 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.
  • Caspol.exe can be used to examine and modify Machine-level, User-level, and Enterprise-level code access security policies
  • The TypeLoadException exception is thrown when the common language runtime (CLR) is unable to find an assembly or the type within the assembly, or cannot load the type.
  • 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 Capture property of the ComboBox class is used to get or set a value that indicates whether or not a control has captured the mouse.

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 criterion.
  • 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.
  • DataSet and DataRelation objects are used to create a relationship between databases. The relationship exists only within the context of the DataSet object.
  • The OLE DB .NET data provider is used by applications to connect to a SQL Server 6.5 database or its earlier versions. The ODBC .NET data provider can be used to create a connection with any data source that can be accessed through ODBC.
  • 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 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.
  • The RowStateFilter property of the DataView class is used to filter rows based on their state, such as ModifiedCurrent, ModifiedOriginal, CurrentRows etc. Users can get data from multiple versions by using the boolean OR operator with the RowStateFilter property.
  • The ModifiedCurrent value for the RowStateFilter property is used to display the modified version of the original data.
  • 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 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 RowFilter property includes a column name defined in a database table, an operator, and a value to filter on.
  • The IsolationLevel enumeration specifies the transaction locking behavior for a connection.
  • When IsolationLevel is specified as a parameter for the BeginTransaction method of the SqlConnection class, the method begins the transaction with the specified isolation level. If the Serializable value is specified for the IsolationLevel enumeration, it prevents more than one user from updating the dataset until the transaction is complete.
  • 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 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 AcceptChanges method was last called.
  • The Select method of the DataTable class can be used to get an array of DataRow objects.
  • The ConnectionString property of the SqlConnection class is used to connect to a data source.
  • The Data Source attribute of the ConnectionString property specifies the name or the network address of the server instance to which a connection is to be established.
  • The Initial Catalog attribute of the ConnectionString property specifies the name of the database.
  • 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 SqlDataReader class avoids creating unnecessary objects or making unnecessary copies of data. Hence, it provides optimal performance.
  • 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 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 represents a parent/child relationship between two DataTable objects. Before creating a relationship, it verifies relationship between the matching columns in the parent and child tables.
  • 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 the Customer table records.
    2. When changes made in the Customer table are either accepted or rejected.
    3. When new records are added to a Customer 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 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 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 SqlParameter constructor accepts two parameters, parameter name and its datatype. Once the SqlParameter object is created, its direction is specified.
  • 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 DataBindings property of the TextBox control is used to bind the control with the data source.
  • 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, the 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.
  • Left outer join produces all records from the left table with the matching records from the joined table.
  • 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 Load method of the XmlDocument class is used to load the contents of an XML file into an XmlDocument object.
  • 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 DataRow of a DataTable object.
  • The CommandType property of the OleDbCommand class is set to the StoredProcedure enumeration to execute the stored procedure specified in the CommandText property.
  • The Update method of the DataAdapter class is used to call an INSERT, DELETE, or UPDATE statement for each inserted, deleted, or updated row in a DataSet from a DataTable.
  • DiffGram is an XmlWriteMode value and it specifies that a DataSet has to be written as a DiffGram containing current and original values.
  • The Copy method of the DataSet class copies both the structure and data of a DataSet object. It returns a new DataSet object having the same structure that includes all DataTable schemas, relations, and constraints and data as the existing DataSet object.
  • 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 Merge method of the DataSet class is used to incorporate the latest changes from a data source into an existing DataSet object.
  • The Dispose method of the the OleDbTransaction class is used to release all unmanaged resources.
  • The DataRowState value that is stored in the RowState property of the DataRow class, specifies whether the DataRow object is added, deleted, detached, modified, or unchanged.
  • The DataRelation class represents a parent/child relationship between the matching columns in the parent and child tables.
  • 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 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 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 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 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 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. It returns the first column of the first row in a resultset.
  • 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 Merge method of the DataSet class is used to incorporate the latest changes from a data source into an existing DataSet object.
  • 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 WriteXml(string, XmlWriteMode) method of the DataSet class is used to write XML schema and data from a DataSet object in XML format.
  • 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 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 GetChanges method of the DataSet class is used to retrieve the records after accepting changes made to a table in a database. It gets a copy of all the changes made before the AcceptChanges method was called or since it was last loaded.
  • The XmlDocument class that defines within the System.Xml namespace is used to represent an XML document.
  • A constructor of the DataRelation class is used to create a DataRelation object that represents the parent/child relationship between two tables. This DataRelation object is then passed as a parameter to the Add method, which adds the object to the data relation collection of the DataSet.
  • The Fill method of the DbDataAdapter class is used to add rows in a DataSet to match those in a data source.
  • The SqlDataAdapter(QueryString1, conn) constructor initializes a new instance of the SqlDataAdapter class with a SQL query string variable and a SqlConnection object. This SqlDataAdapter constructor requires a minimum amount of code.
  • 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. This method writes the DataSet structure as an XML Schema.
  • 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 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 of the DataColumn class 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 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 SqlError class collects warning-related or error-related information returned by the SQL Server database.

Testing and Debugging

  • 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.
  • 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.
  • By setting the TraceSwitch.Level property to the TraceLevel.Info setting will display the error messages, warnings, and short informative messages about an application.
  • The Fail method of the Trace class emits an error without writing the error to the trace listeners.
  • A try block must be accompanied by at least one catch block or one finally block.
  • The EventLogTraceListener class provides a listener that directs debugging or tracing output to an EventLog.
  • 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 EventLog class is used to interact with Windows event logs and the Source property of the EventLog class is used to specify the source name to register and use when writing to the event log.
  • 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 Assert method of the Trace class is used to check for a condition and displays a message if the condition is 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.
  • 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.
  • The Watch window is a debugging window that displays the current watch expressions, whose values are to be monitored, as the code runs. The window can display a value for a watch expression only if the current statement is in the specified context. It is also used to see the values of variables within different scopes, i.e., module level, procedure level, and global variables.
  • Logical errors are those errors that appear in an application once it is in use. An application with logical errors compiles and executes correctly. However, it does not produce the desired result.
  • The Immediate mode of the Command window is used for debugging .NET applications. This mode evaluates expressions, executes command statements, and prints values of variables defined in the application code.
  • The Locals debugging window displays the value of variables within the scope of the current procedure. As execution switches from procedure to procedure, the contents of the Locals window change to reflect only the variables applicable to the current procedure.
  • A breakpoint is used while debugging an application. It specifies a line in a method or sub procedure at which Visual Studio .NET automatically suspends execution.
  • The Write method of the Debug class displays messages and writes variable values to the Output window, when an application is either stopped or paused.
  • Regression testing can be performed any time when a program needs to be modified either to add a feature or to fix an error.
  • The Print method of the Debug class can be used to display a message with a line terminator in the trace listeners collection.
  • When a debugger is attached to a running service, the current functioning of the Web service will be interrupted. As soon as the debugger starts, the service does not actually stop or pause the service’s processing. Instead, it is still in the start mode when the application is debugged, but the service process has actually been suspended.
  • 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 Output debugging window is used to display status messages at runtime. It also displays output that results from debugging instructions placed in the code. The content of the Output window is cleared each time the application is compiled or run.
  • 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 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 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.

Deploying a Windows-based Application

  • The Custom Actions editor is used to define custom actions that can execute code at the end of an installation process to perform actions, such as the installation of location-specific files, which cannot be handled during installation.
  • 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 Launch Condition tab in the Project Properties dialog box is used to specify conditions for installation. These conditions can be used in conjunction with a file, registry, or component search. They can be used to terminate the installation if the specified item is not found.
  • The ToString method of the Exception class provides the maximum information about the exception.
  • 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.
  • The Windows Explorer allows installation and uninstallation of assemblies in the Global Assembly Cache by using drag and drop and menu operations.
  • The File System editor can be used to add project outputs to a deployment project. It can be used to specify the location on the target computer where files are to be installed, and to create shortcuts on the target computer.
  • 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 .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 Installutil.exe tool can be used to install multiple assemblies at a time. It performs installation in a transactional manner.
  • 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 following are the steps that determine the correct version of an assembly:
    1. The CLR examines the application configuration file.
    2. It examines the publisher policy file.
    3. It examines the machine configuration file.
  • Web services directory is a central location for publishing Web service information. These directories are used to locate organizations providing Web services and different Web services provided by an organization.
  • Web service discovery is a preliminary process for accessing a Web site. It locates Web service descriptions. Through the discovery process, Web service clients know about the existence of a Web service, its capabilities, and how to interact with it.
  • The LicenseManager class is used to manage a LicenseProvider. It provides methods and properties for adding license to a control.

Maintaining and Supporting a Windows-based Application

  • The Kill method of the Process class immediately terminates a process. It causes abnormal process termination. If the Kill method is used to terminate a process, the resources allocated to the process and the data edited by the process may be lost.
  • 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 MethodAccessException exception is thrown when there is an invalid attempt to access a private or protected method in a class.

Configuring and Securing a Windows-based Application

  • The User Interface editor allows a developer to change the visual screen, which the user sees while installing the application.
  • Basic authentication is used to authenticate users on the Internet and enables a browser to prompt the user for a username and password. It requires remote users to use a valid Windows NT account name and password to access the Web server.
  • The Code Access Security Policy (Caspol.exe) tool enables users and administrators to view and configure security policies.
  • The SecurityAction enumeration is used to specify the security actions that can be performed by using declarative security.
  • The RequestMinimum value of the SecurityAction enumeration is used to request for the minimum permissions required for code to run.
  • Declarative security check is a security check performed on the declarative information in metadata.
  • Code-access security is a security mechanism that determines whether .NET code is authorized to access a protected resource or not.
  • 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.
  • Authentication is a process of verifying the identity of a person, network host, or system process.
  • Authorization determines whether or not a principal is allowed to perform a requested action.
  • The GenericPrincipal class represents a generic principal. The GenericIdentity class represents a generic identity. Both GenericPrincipal and GenericIdentity classes are used in conjunction with each other to create an authorization scheme. These two 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.
  • The WindowsPrincipal class is used to check the Windows group membership of a 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.
  • 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.

Comments are closed.