This site is 100% ad supported. Please add an exception to adblock for this site.



undefined, object
copy deck
What DataView method do you use to define a sort order based on the Table's primary key?
Sort. It does an asc sort.
Explain why tracing helps with exception handling.
Tracing allows you to record unusual events while your application is running, without users being aware of it. If an unanticipated exception occurs, your application can write a message to the trace log, which helps you diagnose problems during testing and after deployment.
How do you use an XML web service from client-side script?
1) Create a style class for the WebService behavior (

2) Add an HTML element to the page that uses the class you created in step 1.

3) Write script procedures to initialize and call methods on the XML Web service using the XML Web service behavior.
What are the 6 ASP.NET Validation controls?
1. RequiredFieldValidator
2. CompareValidator
3. RangeValidator
4. RegularExpressionValidator
5. CustomValidator
6. ValidationSummary
What are the four types of internet applications?
1. Web applications
2. Web services
3. Internet-enables applications
4. Peer-to-peer applications
How do you create a DataView object?
Either get a reference to the DefaultView property of a Table object or use the DataView() constructor. Note that you will not be able to reference data until you set the DataView's Table property.
To declaritively control output caching of an ASP.NET page, what do you do?
Set the OutputCache page directive.
What are three limitations of User Controls?
1) A copy of the User Control must exist on each web application project where it is used.

2) User controls cannot be loaded into the VS .NET Toolbox. Instead, you must create them by dragging the control from the Solution Explorer to the Web Form.

3) User control code is initialized after the Web Form loads, which means user-control property values are not updated until after the web form's Page_Load event.
List two different exception-handling approaches in ASP.NET Web ­applications.
Exceptions can be handled in exception-handling blocks using the Try, Catch, and Finally keywords in Visual Basic .NET or the try, catch, and finally keywords in Visual C#. They can also be handled using Error event procedures at the Global, Application, or Page levels using the Server object' s GetLastError and ClearError methods.
What DataView method creates an asc sort on the primary key of the table when the Sort property is a null reference or an empty string?
What exe do you use to sign an assembly with a strong name?
Al.exe (Assembly Linker)
What namespace must you include in order to invoke a Win32 API function in ASP.NET?
Explain the difference between handling transactions at the data set level and at the database level.
Data sets provide implicit transactions, since changes to the data set aren' t made permanent in the database until you call the Update method.

Databases provide explicit transactions through the Transaction object. You create a Transaction object from a database connection, and then assign that Transaction object to the commands you want to include in the transaction through the command object' s Transaction property.
What is faster, the DataView's RowFilter method or the Find/FindRows method?
The Find method, because RowFilter causes the index to be rebuilt, while the Find or FindRows method leverages the current index.
How do you check to see if a browser supports frames?
Do User Controls support Grid Layout, Flow Layout, or both?
Only Flow Layout.
What are the two main parts of the .NET Framework?
1. The common language runtime.
2. The .NET Framework class library.
What happens when you add an object to a collection that goes over the maximum capacity of the collection?
The collection automatically expands.
What authentication method would you use for a public internet site?
Describe the life cycle of a Web application: When are Web forms instantiated and how long do they exist?
A Web application starts with the first request for a resource within the application' s boundaries. Web forms are instantiated when they are requested. They are processed by the server and are abandoned immedi­ately after the server sends its response to the client. A Web application ends after all client sessions end.
What is the code for creating a new row from a dataset?
DataRow myDataRow = dsBen.Tables["MyTable"].NewRow();
What are the 8 kinds of page directives?
1. Page
2. Control
3. Import
4. Implements
5. Register
6. Assembly
7. OutputCache
8. Reference
Explain where Visual Studio .NET stores Web application projects.
Web application projects are stored in a new virtual folder for each project. The properties of that virtual folder determine where the files are physically stored. These properties can be viewed in IIS.

In addition to implementing the ICollection interface, what three elements to all collections share?
1. An enumerator (pointer than moves through the collection).

2. Synchronization methods (a SyncRoot property used to create their own thread-safe wrapper)

3. CopyTo method. (used to copy the collection to a single-dimensional array)
How do you authenticate users who access HTML pages using Windows, Forms, or Passport authentication?
Map HTML file extensions to the ASP.NET executable using the IIS snap-in.
If you want to position controls in a User Control using Grid Layout, what would you do?
Add a Grid Layout control to the User Control. Use it as a container for the controls you want to position.
How do you call a member of a base class from within a derived class?

To refer to a member of a base class in Visual Basic .NET, use the MyBase keyword. To refer to a member of a base class in Visual C#, use the base keyword.

If you set a control's AutoPostBack property to True, and no postback occurs when a change event happens, what might be happening?
The client might have scripting disabled on the browser. AutoPostBack relies on scripting.
What is the code for adding a datarow object to a dataset?
What two controls can fire off postback events?
Button and ImageButton
Why can' t you open a new browser window from within server code?
Server code executes on the server, whereas the new window is created on the client. You need to use client-side code to do things that affect the client, such as upload files, display new windows, or navigate back in history.
What namespace are SmtpMail and MailMessage a part of?
What file types do the three ASP.NET authentication modes apply to?
aspx, asax, and other resources processed through the web app's executable. Does not automatically include html or htm files.
What server control property links the control to a stylesheet?
What are the four main objects used in Web application programming?

The four main objects in Web application programming are the Application, Page, Request, and Response objects.
Can web services be run from the server or the client?
What is a limitation of the String class?
Once an instance of the String class is set, its value is immutable. Changing the value succeeds, but it destroys the old String and creates a new one.
A User Control's class is based on what base class?
In Visual Basic .NET, what is difference between a class module and a code module?

Class modules are instantiated at run time to create objects that provide separate storage for variables and properties in each instance. Code mod­ules do not have instances, so any module-level variables they use are shared among calls to the module' s procedures.
If you want to send a simple text mail message, what is the best class to use?
What are the three authentication methods in an ASP.NET application?
1. Windows integrated authentication
2. Forms authentication
3. Passport authentication
What determines the boundaries of a Web application?
IIS determines Web application boundaries by the structure of the appli­cation' s virtual folders. A Web application boundary starts in the folder containing the start page of the application and it ends at the last subordi­nate folder or when it encounters another start page in a subordinate folder.

To set an ArrayList's size to its number of elements, what method should you use?
What are the five steps to creating a User Control in a web application?
1) Add a Web User Control page (.ascx) to your project.

2) Draw the visual interface of the control in the designer.

3) Write code to create the control' s properties, methods, and events.

4) Use the control on a Web form by dragging it from the Solution Explorer to the Web form where you want to include it.

5) Use the control from a Web form' s code by declaring the control at the module level and then using the control' s methods, properties, and events as needed within the Web form.
In Visual C#, how do you declare a method to make it available without having to first instantiate an object from the class?

To create a method that can be called without instantiating an object, declare that method as static.
How do you test if the browser supports VBScript or Javascript?
How do you find the storage capacity of a Strinbuilder class?
Stringbuilder.Capacity returns the number of bytes in the buffer.
What function do you do to load a user control dynamically?

ex. this.LoadControl(myControl);
How do you send mail from the server?
Use the SmtpMail or MailMessage class.
What exe would you use to manage keys, signature generation, and signature verification for strong-named assemblies?
Sn.exe (Strong Name tool)
If you try to access properties of a User Control in the web form's Page_Load event, what will happen?
You'll see the User Control's properties as they are initially set. This is because the User Control's code does not run until after the Web form's Page_Load event.
What namespace should you include for an internet-enabled application?
If you want to send a formatted mail message or one containing an attachment, what is the best class to use?
What method would you use to return a character at a specified 0-based index in a String or Stringbuilder class?
When does a User Control's Page_Load event run?
Right after the containing Web Form's Page_Load event.
Why doesn't Visual Studio automatically complete the following line of code? (C# only)

int intX = system.math
The System.Math namespace must be capitolized for C# IntelliSense to recognize it.
If you need a simple sequential list where the value is discarded when it's accessed, what should you use?
A Queue (first-in, first-out) or a Stack (last-in, first-out)
If you're trying to access a web app that has Windows authentiation enabled over the internet, what happens?
You're prompted to enter your credentials which will be validated against a list of Windows accounts.
If a User Control's property or method setting needs to retain a setting between pages, what should you do?
Write code for saving and restoring the settings in the ViewState.

Where would you save the following data items so that they persist between requests to a Web form?

1. A control created at run time.

2. An object that provides services to all users.

3. User preferences
1. Save controls created at run time in the Page object' s ViewState.

2. Save objects that provide services to all users in the Application state.

3. Save user preferences in SessionState.
What is a SortedList?
Represents a collection of key-and-value pairs that are sorted by the keys and are accessible by key and by index.
How do you use a COM component in a .NET application?
A .NET-compatable assembly must be created using the Type Library Importer (Tlblmp.exe)
Give a code-example of a User Control integer property that retains its state throughout pages.
public int Value
//return the value
return Convert.ToInt32(ViewState["Value"]);
//set the value
ViewState["value"] = value;
How do you get several RadioButton controls to interoperate on a Web form so that only one of the RadioButtons can be selected at once?
Set the GroupName property of each RadioButton to the same name.
What is an ArrayList?
An ArrayList is a class that uses an array whose size can be dynamically increased as required. It consists of two properties, called Capacity, which indicates the number of elements the ArrayList may contain. And the property called Count , which gives the number of elements the ArrayList contains. It implements the IList interface.
What is the default authentication method when you create a new Web application project?
Windows authentication
If you try to access a User Control's property in the web form's Page_PreRender event, what happens?
You will get the most up-to-date value in the property.
When can't you use ASP.NET to create Web applications?
When you are developing for a non-Microsoft web server, such as Linux/Apache.
What is a ListDictionary?
This is a simple implementation of IDictionary using a singly linked list. It is smaller and faster than a Hashtable if the number of elements is 10 or less. This should not be used if performance is important for large numbers of elements.
What method inherited from Object allows the object to free resources and perform cleanup operations before the garbage-collector comes?
When validation controls are set to dynamically display error text, what does that mean?
No HTML space is reserved for the message. In static, HTML space is reserved for the message.
How does the .NET Framework organize its classes?
The .NET Framework uses namespaces to organize its classes.

If you try to use the ArrayList.Sort() method on an arraylist that contains different types, what happens?
Run-time error. The Sort method only works when an ArrayList contains the same types.
What exe allows you to view and manipulate the contents of the GAC and download cache?
Gacutil.exe (Global Assembly Cache Tool)
What is the process of assigning a user account to an unknown user?
What method returns a reference to an instance of a String?
What is the StringCollection class?
Represents a collection of strings. No Syncronize method for thread-safety, though derived classes can use the SyncRoot property.

Duplicate strings are allowed in StringCollection.

String comparisons are case-sensitive.

Indexes in this collection are zero-based.
What steps would you follow and what objects would you use to quickly find the number of records in a database table?
There are two ways to accomplish this task:

1. Use a database connection and a command object to execute a SQL command that returns the number of rows in the table.

2. Use a database connection and data adapter object to create a data set for the table, and then get the number rows in the data set.
If an authorization setting is made in IIS and Web.config, which setting is evaluated first?
IIS then Web.config
To find information about the authentication user, what class do you use?
What are the two approaches to storing and retrieving user information thorugh cookies?
1. Store all the information as a cookie on the client's machine.

2. Store an identification key on the client's machine, and then retrieve user information from a data source on the server using that identification key.
How dow you restore the default window settings in Visual Studio .NET?
Tools -> Options -> Click Reset Window Layout.
What two state collections does HttpApplicationState expose?
Contents and StaticObjects
Can you include both a Name and an Src in an Assembly page directive?
No, it must be one or the other. If you want to include both on a page, you must assign two Assembly directives.
Where are the settings used by the web server when processing a project stored?
How do you reuse a database connection component throughout a Web application?
Add the database connection component to the Global.asax file, then create a state variable in the Application_Start or Session_Start event procedures to share the connection with the Web forms in the application.
How do you get the name of the authenticated user?
How do you reference an XML Web Service in your project?
Set it up as a Web Reference.
Where are style definitions for your project stored?
Why can' t you open a new browser window using server-side code? How would you display a page in a new window with a client-side script?
Server-side code can execute tasks only on the server. To perform a task on the client' s computer, such as opening a new browser window, the code needs to run on the client.

<button id="butHelp"
onclick="'help.aspx', 'help', 'height=200,width=300')">Help</
How many pages can access the Application state at the same time?
Any number. Technically all HttpHandler and HttpModule instances.
How do you disable automatically adding /bin-directory assemblies to your ASP.NET pages?
Comment out the <add assembly="*" /> element in Web.config
How doe Web Form applications differ from Windows Form applications?
1. Tools. Web forms cannot use the standard Windows controls. Instead, they use server controls, HTML controls, user controls, or custom controls created specially for Web forms.

2. User interface. The appearance of a Web form is determined by the browser that displays it.

3. are destroyed. Web forms appear to behave this way, but in fact they are instantiated, sent to the browser, and destroyed immediately.

4. Execution. The executable portions of a Web application live on the Web server.
What is the main difference between the Button server control and the Button HTML control?
When clicked, the Button server control triggers an ASP.NET Click event procedure on the server. The Button HTML control triggers the event procedure indicated in the button' s onclick attribute, which runs on the client.
What method of the HttpApplicationState class locks access to the application state for syncronization purposes?
What is the easiest way to search for an XML Web Service on the net?
The easiest way is just to select XML Web services from the Start page in Visual Studio .NET
How do you determine how many page requests to write to a trace log?
In the Web.config file, set the <trace> element's RequestLimit attribute to a numerical value.
What is wrong with the following line of code?

You can' t use the Transfer method with HTML pages. It works only with .aspx pages.
To make late-bound calls to a COM-component in ASP.NET, what would you do?
Calls to legacy ASP pages are single-threaded or multithreaded?
Can you create an ASP.NET application in a place other than a location that has been published by IIS as a virtual folder?
How do you display a page in one frame from a hyperlink in another frame?
Use the <a> element' s target attribute to specify the frame to display the page. For example, the following hyperlink displays a page in the main frame of a frameset:

<a href="AllTheAnswers.aspx" target="main">Show the answers!</a>
Can pages running outside the web application's context acces the web app's Application state?
How are XML Web Services made public over the web?
Universal Description, Discovery, and Integration (UDDI) registry
Where are the build options for the project stored?
What is the term for a set of rules that describe how two or more items communicate over an element?
What does the Type Library Importer utility do?
Builds a managed wrapper around the COM component.
What namespaces is the Stringbuilder class located in?
Using the Trace object, how would you write to a log file?
Use the Trace.Warn or Trace.Write methods. Warn is red, Write is black.
What namespace should you include for a peer-to-peer application?
How do you tell the authentication type being used?
if you declare an instance of Stringbuilder as

StringBuilder s = new StringBuilder("dotnetrocks");

What would the result of s.Length be?
Do you have to recompile your application when enabling or disabling tracing in the application's configuration file?
What namespace should you include when writing a web sercvice?
What does HttpApplicationState.Contents do?
Exposes all variables added to the application collection by code.
What method creates a new instance of a String with the same values?
Where are the descriptions of the web services this project provides stored?
How do you deny all users?
<deny users = "*" />
What namespace is the String class located in?
How would you determine if Tracing is enabled?
Check the value of the Trace.IsEnabled property.
List the four major differences between Web and Windows applications.
1. Web forms cannot use the standard Windows controls. Instead, they use server controls, HTML controls, user controls, or custom controls created specially for Web forms.

2. Web applications are displayed in a browser. Windows applications display their own windows and have more control over how those windows are displayed.

3. Web forms are instantiated on the server, sent to the browser, and destroyed immediately. Windows forms are instantiated, exist for as long as needed, and are destroyed.

4. Web applications run on a server and are displayed remotely on clients. Windows applications run on the same machine they are displayed on.
What class is created the first time a request is made for a resource in your web app?
Why is the Stringbuilder class faster than the String class?
It reserves space for 16 characters in memory by default. As long as there is room, when you append to a Stringbuilder object no new memory needs to be allocated.
How do you write the trace log to a file?
In the Web.config file, set the <trace> element's PageOutput attribute to False.
What types of validation would you use to verify that a user entered a valid customer number?
You would use a RequiredFieldValidator and a RegularExpressionValidator. If you have access to a list of expected customer numbers, you could replace the RegularExpressionValidator with a CustomValidator that checked the list.
When running an MTS component in ASP.NET, what do you first need to do?
Set the account under which the COM component runs to a special account created for this purpose.
Is it possible to use SqlDataAdapter to fill a dataset with an ADO Recordset?
No, you must use OleDbDataAdapter
Where are global events that occur in your web application defined?
What are the major differences between an ASP.NET web application and a windows application?
1. Client/server architecture.
2. Runs under CLR using managed code.
3. User interface is displayed in an Internet browser using Web Forms.
What can be stored in Application state?
.NET objects and variables.
Why does ASP.NET perform validation on both the client and the server?
Client-side validation helps avoid round trips to the server. Validating on the client makes sure that the data is valid before it is submitted, in most cases. However, because validation might be turned off (or maliciously hacked) on the client, data must be revalidated on the server side. This provides full assurance that the data is valid while avoiding as many round trips as possible.
What is the file extension for the XML schema created with the DataSet classes?
How do you preserve persistent data, such as simple variables, in a Web application?
You can preserve data in state variables, such as ApplicationState, SessionState, or ViewState.
When is the memory for an object placed in Application state removed?
When the object is explicitely removed or replaced. It stays in memory otherise (ie, a 10mb recordset would stay in memory).
Describe the purpose of error pages and why they are needed.
Because Web applications run over the Internet, some exceptions occur outside the scope of the application. This means that your application cannot respond directly to these exceptions. These types of exceptions are identified by HTTP response codes, which IIS can respond to by displaying custom error pages listed in your application' s Web.config file.
What is the name for a virtual folder that contains an ASP.NET application?
What steps would you want to follow when writing code for an erorr event?
1. Get the exception that occured using Server.GetLastError()

2. Do something with the exception, such as display a message to the user, take steps to correct the problem, or write to an error log.

3. Clear the exception using Server.ClearError()

4. Redisplay the page. Web form processing stops immediately when an exception occurs, so server controls and other items on the page might not be displayed after the exception is cleared.
What is the file extension for a web service?
What event in the global.asax file is fired when an authorization event occurs?
What file stores the design-time Web preferences for the project?
Is the application state single or multi-threaded?
Where are the resources used by the Web form stored?
What method of the HttpApplicationState class unlocks access to the application state for syncronization purposes?
How do you turn tracing on fro an entire application?
Set the application's <trace> element's Enabled attribute to True in the Web.config file.
Application is a property of what?
What is the file extension for a User Control?
What does Application.StaticObjects do?
Exposes all variables added to teh application collection by <object runat=server> in the Global.asax.
How do you enable tracing for a single page?
Set the DOCUMENT object's Trace property to True or set the Page directive's Trace attribute to True.
How do you get the role of the authenticated user?
What is Tracing?
A technique for recording application events.
How do you deny unauthorized users?
<deny users = "?" />
What file lists the files and settings used at design time?
What threading method do all CLR custom objects have?
If you want to define a new exception, what do you do?
Create a class that inherits from the ApplicationException class.
What method of the Server object returns the last error that occurred?
What DataSet method gets a copy of the DataSet including all changes made since it was last loaded or AcceptChanges was called?
What are the three types of error events?
1. Page_Error
2. Application_Error
3. Global_Error
How do you limit authorization to a specific list of users in Windows authentication?
<allow users="Ben Randolph, Paul Norrigan, Mark Reidel" />
<deny users = "*" />
To handle errors in statements that might fail because of external conditions, what do you use?
Exception-handling blocks (try-catch-finally)
How do you convert a COM component to a .NET-compatable assembly?
the Type Library Importer utility (TlbImp)
What is the difference between the ApplicationException class and the Exception class?
None, except for the fact that ApplicationException reflects custom exception classes created by the programmer.
When might you have to explicitely code thread-syncronization methods around an application-scoped object?
If the application-scoped object is not free-threaded.
Why would you want to cause an exception in a real-world application?
To have more control on when and where the exception takes place, and know what code is handling it.
How do you tell if a user is authenticated?
To handle errors withing the scope of an object, what do you use?
Error events
What dataset method should you use to read XML into the dataset?
Using exception-handling blocks to deal with exceptions in the scope of the procedure is called what?
Structured exception handling
How do you remove a cookie from the client's machine?
Set the cookie's Expires property to DateTime.Now
What keyword causes an exception to occur?
What is a description of the data elements contained in an XML file?
XML schema
If you want to view the trace log from a remote machine, what do you do?
Set the <trace> element's LocalOnly attribute to False in the Web.config file.

<trace enabled="true" requestLimit="20" pageOutput="false"
traceMode="SortByTime" localOnly="false" />
How do you create an XML schema from an XML file in Visual Studio.NET?
Select Create Schema from the XML menu while the XML file is displayed in the Design window.
What keyword interceptions general exceptions
How do you create an XML file in Visual Studio .NET?
Choose Add New Item from the Project menu. Select XML File from the Templates list.
Errors that are not dealt with in code are called what?
Unhandled exceptions
What method of the dataset should you use to find one particular record in an XML file?
How do you view a list of exceptions types?
Debug -> Exceptions. Visual Studio .NET displays the Exceptions dialog box.
What dataset method should you use to save information from the dataset to an XML file?
What method of the Server object clears the last exception that occured on the server?
How do you create a cookie that expires thirty days from now?
Set the cookie's Expires property to DateTime.Now.AddDays(30)
Why would you want to use error events as opposed to exception-handling blocks?
Two reasons:

1. As a substitute for exception-handling blocks. (though you have less information as to the steps leading up to the error).

2. As an adjunct to exception-handling blocks. (to handle errors unforseen in the error-handling blocks).
How would you use a cookie to store user information on the server?
1. Create a unique key to identify the user.

2. Save the unique key as a cookie on the user' s computer.

3. Create a file on the server to store user information.

4. Save the user information on the server using the unique key as an index.
When handling exceptions in error events, what would you use to get information about the exception that occurred?
The Server object.
How would you retrieve specific values from a cookie?
Use the key's name.


What namespace would you include if you wanted to create a class that inherits from the ApplicationException class?
What do you add to the XML schema to enable searching?
Primary Key
What is the name of the logfile written-to when Tracing is set to write to a log?
To use an XML file with a data set, you must first do what?
Create an XML schema for the dataset.
How much information can you store on a cookie?
4096 bytes
What dataset method should be called first, ReadXMLSchema() or ReadXML()?
What dataset method should you use to read an XML schema into the dataset?
How do you create a cookie that never expires?
Set the cookie's Expires property to DateTime.MaxValue
How do you add a key field to an XML schema?
1. Right-click the element to create as a key, select Add, and then select New Key from the pop-up menu. Visual Studio displays the Edit Key dialog box.

2. Select the Dataset Primary Key check box and click OK to make the element a primary key within the data set.
What steps should you follow when writing a cookie to a client machine?
1. Check whether the client supports cookies by using Browser.Cookies.

2. If the client supports cookies, check whether the cookie already exists by using the Request object' s Cookies collection.

3. If the cookie does not already exist, create a new cookie object using the ­HttpCookie class.

4. Set the cookie object' s Value and Expiration properties.

5. Add the cookie object to the Response object' s Cookies collection.
What namespace contians classes for creating globally unique identifiers?
How would you create a new GUID?
DataSets work with what types of data stores?
Databases and XML
What is the default time that cookies expire?
When the user's session ends.
Are cookies case-sensitive?
Using Visual Studio.NET, how do you create an XML file to store information from a dataset.
1. Create an XML file in Visual Studio.

2. Generate an XML schema from the XML file. The XML schema enables the data set to refer to data in the XML file by name.

3. Specify a key field within the XML schema. This will let you find records using that field with the data set' s Find method.

4. Read the XML schema and XML file into a data set.

Deck Info