Practice Exam Qaj
Your application's custom directory contains a web.config file with this setting lt customErrors mode Off gt Your application's custom local directory contains a web.config file with this setting lt customErrors mode On gt lt error statusCode 404 redirect 404.htm gt lt customErrors gt A user at a remote computer requests the file custom remote bad_doc.aspx, which does not exist. What is the result A. The 404.aspx file is displayed. B. The default ASP.NET error page is displayed. C. The 404.htm...
Info Jgh
Open Server Explorer. Expand the tree under Event Logs. Drag and drop the Application event log to the Web form. This creates an eventLog1 object in the component tray. Access the properties of the eventLog1 object and change its Source property to EventLogApp. Change the MachineName property to . a single dot so that it refers to the local computer no matter what computer the application is installed on. Click the Add Installer link just above the description area in the Properties window as...
Step By Step Pnv
15.6 Using the Windowsldentity and WindowsPrincipal Objects 1. Add a new form to your Visual C ASP.NET application. You should leave the application set to perform Windows authentication with impersonation, as it is at the end of Step by Step 15.5. 1010 Part III MAINTAINING AND CONFIGURING A WEB APPLICATION Modify the Domain Name This code contains a reference to a specific domain named INFINITY in its call to the IsInRole method. You should change that to the name of your own domain to test...
Step By Step Uvc
5.8 Binding a DataView Object to a DataGrid Control 1. Add a new Web form to the project. 2. Place a DataGrid control dgExams on the Web form. 3. You need the Exam.cs class created in Step by Step 5.5, so create it now if you didn't already create it. 4. Double-click the Web form and add the following code in the Page_Load event handler Create an Exam class object and call DataLoad method to assign it to the DataGrid's DataSource Exam exam new Exam dgExams.DataSource exam.DataLoad...
Using the File Class
The File class represents a disk file. The File class contains static methods that allow you to create, open, move, copy, and delete files. They also contain a set of methods that provide access to the information about the files. The File class performs security checks on all its methods. This class also helps in creating FileStream objects, which is discussed in the next section. You will see the usage of the File class extensively in the following sections. The .NET Framework also provides...
Figure 225
The Calendar control provides a large number of style properties that can be used to provide a custom appearance to the calendar. 3. Expand the node next to the TitleStyle property of the Calendar control in the Properties window and set different values for the sub-properties to provide a custom style to the title of the Calendar as shown in Figure 2.25. Similarly, set other properties such as DayHeaderStyle, DayStyle, SelectorStyle, SelectedDayStyle, and so on to provide the desired custom...
Web Garden
A Web garden is a Web application whose execution is distributed across more than one processor on a multiprocessor computer. Web gardening is the default behavior for ASP.NET. For example, suppose that you install an ASP.NET application on a computer with eight CPUs. In this case, ASP.NET will automatically launch eight worker processes to handle incoming Web requests, and assign one of these processes to each CPU a procedure known as setting the affinity of the process . Web gardens offer the...
Q Oas
You should know how to construct a SQL Server connection string for use with the SqlConnection object. There are three parts to the string. First is the Data Source, which is the name of the server to which you'd like to connect. You can use local as a shortcut name for the SQL Server instance running on the same computer as this code. Second is the Initial Catalog, which is the name of the database on the server to use. Third is authentication information. This can either be Integrated...
Creating a Custom TraceListener Object
1. Using the Add Class Wizard, add a new class to the project, name the class EmailTraceListener.cs, and add the following code to it changing the From address to a valid email address public class EmailTraceListener TraceListener message log will be sent to this address private string mailto stores the message log private StringBuilder message public EmailTraceListener string mailto A custom listener must override Write method public override void Write string message this.message new...
Q Jmg
private void dlOrders_UpdateCommand object source, e HtmlInputText htEdit Get the existing data sqlDataAdapter1.Fill dsOrders1, Orders Get the changed data and put it in the database htEdit e.Item.ItemIndex 7 htEdit.Value Turn off editing dlOrders.EditItemIndex -1 re-bind the data DataBind 12. Set the Web form as the start page for the project.
Q Dxi
In Step by Step 3.1, I am using the event handler for the Load event of the Page class to check if the page is loaded by a postback operation. If that is the case, I skip executing the code for adding items to the drop-down list. You also note that the navigation between controls is not smooth. When the form returns after a postback, it does not remember the active control. However, you have a solution to this problem with the help of the SmartNavigation property. ASP.NET has a feature called...
Info Jhk
9. Click on the Save button and save the view as vwCustOrders. Close the design window for the view. 10. Drag the vwCustOrders view from Server Explorer and drop it on the form. You get a configuration error because the view is read-only. That's not a problem because you're not writing any data back to the database click OK to create objects. This creates two visual data objects, sqlConnection1 and sqlDataAdapter1. 11. Select the sqlDataAdapter1 object. Click the Generate Dataset link below the...
Step By Step Ary
5.5 Binding Data to a List in a ListBox Control 1. Add a new Web form to the project. 2. Place a ListBox control lbExams on the Web form. 3. Add a new class named Exam.cs to the project. Enter this code in the class DataTable dtExam new DataTable DataView dvExam DataRow drExam Add two columns to the DataTable dtExam.Columns.Add new DataColumn ExamNumber, dtExam.Columns.Add new DataColumn ExamName, drExam dtExam.NewRow drExam 0 315 drExam 1 Web Applications With Visual C .NET dtExam.Rows.Add...
Exam Questions Bnj
1. You have inherited a large ASP.NET application because the original developer has left the company. You are concerned because there does not seem to be sufficient error trapping in the code-behind files to catch all likely errors. What is the easiest way for you to begin tracking all unhan-dled errors A. Add error trapping to every method behind every page. B. Add a Page_Error event handler to each page's code-behind file. C. Add an Application_Error event handler to each page's code-behind...
As Jbx
INSERT INTO Products ProductName, CategoryID VALUES ProductName, CategoryID SELECT ProductID IDENTITY 6. Switch to code view and add the following using directives using System.Data.SqlClient using System.Data.SqlTypes 7. Double-click the form and enter the following code to fill the list in the ComboBox control in the form's Load event handler private void Page_Load object sender, System.EventArgs e Retrieve data for the drop down list SqlCommand cmdCategories sqlConnection1.CreateCommand...
Info Cvv
Elements of Event Handling Event Arguments Event Handlers Delegates Events Publishing and Subscribing to an Event Publishing an Event Subscribing to an Event Handling Events by Overriding the Virtual, Protected Method of the Base Class Handling Events by Attaching a Delegate Handling Events of the Page Class Through Separating User Interface from Business Logic Using Code-Behind Without Precompilation Using Code-Behind with Precompilation Creating a Web Form Using Visual Studio .NET Analyzing...
Step By Step Eqx
1. Open a Windows command prompt. 2. Type the following to launch osql and log in using Windows integrated authentication 3. To execute a query in osql, you must first tell it which database to use. To do so, type this SELECT FirstName, LastName FROM Employees 5. Tell osql to execute the SQL statements that you just entered 6. When you're done with osql, type exit Here's the entire osql session, including the prompts from osql 2 gt SELECT FirstName, LastName FROM Employees 3 gt GO FirstName...
Anatomy of a Configuration File
The easiest way to learn about the structure of configuration files is to look inside one. Let's start with the master configuration file that controls ASP.NET's operations on the computer. Its name is machine.config, and you'll find it in a directory underneath your Windows installation directory, whose name is based on the version of the .NET Framework installed. For example, on a Windows 2000 computer with the initial release of the .NET Framework installed, this file is at CONFIG...
Step By Step Oik
11.1 Creating a Simple Web Application 1. Create a new Visual C .NET Web application. 2. Add a new Web form StepByStepll_l.aspx to the application. Set the pageLayout property of the form to FlowLayout. 3. Arrange two Label controls lblHeadline and lbllnstructions , an Image control imgDecor , a TextBox control txtRandomNumber , a Button control btnGetRandom , and a Hyperlink control hlOptions on the Web form. Figure 11.1 shows a design for this form. 4. Set the NavigateUrl property of the...
Step By Step Jyh
3.3 Using the HttpRequest Intrinsic Object 1. Add a new Web form to the project. Name the Web form StepByStep3_3.aspx. Change the pageLayout property of the DOCUMENT element to FlowLayout. 2. Add a Label control lbllnfo to the Web form. 3. Switch to the code view of the form. Add the following using directive at the top of the code-behind file 4. Add the following code to the Page_Load event handler StringBuilder sblnfo new StringBuilder Display some of the path related properties of the...

