ASP.NET Flash Cards

Play Memory | Create Card File | Append to Card File
Title: ASP.NET
Description: Flashcards for ASP.NET
Number of Cards: 210
Save Count: 22
Author: elric21211
Created: 2002-10-03
Tags: microsoft
Private No

Save Count represents the number of people who have saved this card set to their flashcard list. Consider this an endorsement!

    • Question
    • Answer
    • Side 3
    • What DataView method do you use to define a sort order based on the Table's primary key?
    • Sort. It does an asc sort.
    • To cache pages based on whether you get the same querystring argument or not, what do you do?
    • Set the VaryByParam of the OutputCache directive.

      <%@ OutputCache=10 VaryByParam=task %>
    • Give an example of a @Register directive for registering a User Control on a Web form.
    • <%@ Register TagPrefix="ucBen" TagName="BensControl" Src="Ben.aspx" %>
    • 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 (Webservice.htc).

      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.
    • To cache pages based on a property of a control, what do you do?
    • Use the VaryByControl of the OutputCache directive.

      <%@ OutputCache=10 VaryByControl %>
    • 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?
    • ApplyDefaultSort
    • 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?
    • System.Runtime.InteropServices
    • 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?
    • Request.Browser.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?
    • Anonymous
    • What directive does VS.NET set when you drag a User Control from the Solution Explorer to a Web form?
    • @Register
    • 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 to send a text message using SmtpMail?
    • SmtpMail.Send("someone@microsoft.com", "joeblow@what.com", "Message text");

      sends a mail from someone@microsoft.com to joeblow@what.com
    • 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?
    • ds.Tables["MyTable"].Rows.Add(myDataRow);
    • 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?
    • System.Web.Mail
    • 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?
    • CssClass
    • 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?
    • Both
    • 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?
    • System.Web.UI.UserControl
    • 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?
    • SmtpMail
    • 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?
    • TrimToSize()
    • 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?
    • Request.Browser.VBScript
      or
      Request.Browser.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?
    • LoadControl

      ex. this.LoadControl(myControl);
    • How do typed data sets differ from untyped data sets, and what are the advantages of typed data sets?
    • Typed data sets use explicit names and data types for their members, whereas untyped data sets use collections to refer to their members. The following examples show a typed reference vs. an untyped reference to a data item:

      // Typed reference to the Contacts table's HomePhone column.
      DataSet1.Contacts.HomePhoneColumn.Caption = "@Home";
      // Untyped reference to the Contacts table's HomePhone column.
      DataSet1.Tables["Contacts"].Columns["HomePhone"].Caption = "@Home";
    • 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?
    • System.Net
    • If you want to send a formatted mail message or one containing an attachment, what is the best class to use?
    • MailMessage
    • What method would you use to return a character at a specified 0-based index in a String or Stringbuilder class?
    • Char
    • 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
      {
      get
      {
      //return the value
      return Convert.ToInt32(ViewState["Value"]);
      }
      set
      {
      //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.