ASP.NET
  Home arrow ASP.NET arrow Page 5 - How to Test and Debug an ASP.NET 2.0 Appli...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

How to Test and Debug an ASP.NET 2.0 Application
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2006-05-11

    Table of Contents:
  • How to Test and Debug an ASP.NET 2.0 Application
  • How to create a remote IIS web site
  • How to test an ASP.NET application
  • How to test an application with a browser other than the default
  • How to test a file-system web site with IIS

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    How to Test and Debug an ASP.NET 2.0 Application - How to test a file-system web site with IIS


    (Page 5 of 5 )


     
    When you run a file-system web site, it runs under the ASP.NET Development Server by default. Because this server has limitations, however, you’ll want to be sure to test a file-system web site under IIS as well as under the development server. Figure 4-6 describes how you do that.

    To start, you need to create a virtual directory for the web site as described in figure 4-1. Then, if you open the web site from this virtual directory, it will automatically run under IIS. Alternatively, you can open the file-system web site directly and change its start options so the URL you specify is used to start the application. In this figure, for example, you can see that the Use Custom Server option has been selected and the URL for the web site’s virtual directory has been entered in the Base URL text box.

    This figure also lists the limitations of the ASP.NET Development Server. The most significant of these limitations is that it always runs under the current user’s security context, but your own user account probably has stronger security privileges than the account IIS runs ASP.NET applications under. As a result, when you move the application to a production web server, you may have to contend with security issues that weren’t apparent when you tested with the development server, especially if you access files or databases located in folders outside of the application’s folder structure.

    The dialog box for specifying a web server


    Figure 4-6.  How to test a file-system web site with IIS

    How to test a file-system web site with IIS

    1. Create a virtual directory for the web site as described in figure 4-1.
    2. Open the web site from its virtual directory, or open the file-system web site and then use the Property Pages dialog box shown above to specify the URL for the virtual directory.
    3. Run the application using one of the techniques in figure 4-4.

    Limitations of the ASP.NET Development Server

    • Can serve pages only to the local computer.
    • Runs in current user’s security context, so it doesn’t accurately test security issues.
    • Does not include an SMTP server, so it can’t be used to test email applications.
    • Uses a randomly chosen port rather than the standard HTTP port 80.

    Description

    • By default, a file-system web site is run using the ASP.NET Development Server. To run a file-system web site using IIS, you can use one of the techniques above.
    • To open the Property Pages dialog box, right-click the project in the Solution Explorer and select Property Pages from the shortcut menu. Then, to change the server that’s used to run the web site, click the Start Options node, select the Use Custom Server option, and enter the URL of the virtual directory for the web site.

    How to test an application from outside of Visual Studio

    Once you’ve thoroughly tested and debugged an application from within Visual Studio, you’ll want to run it from outside of Visual Studio to make sure it works properly. Figure 4-7 describes how you do that.

    To start, you open the browser you want to use. In this example, I used Mozilla Firefox. Then, you enter the URL for the starting page of the application and press Enter. When you do, a request for the page is sent to the server and the resulting page is displayed in the browser.

    Note that to run a local IIS web site, you use “localhost” in the URL to identify the server. The URL in this figure, for example, refers to the Order.aspx page of the Ch03Cart web site. This web site is located in the ASPNET2005 directory of the local IIS server. In contrast, to run a remote IIS web site, you specify the actual server name in the URL like this: 

      http://mma1/ASPNET2005/Ch03Cart/ Order.aspx

    And to run an FTP web site, you enter the browse location like this:

      http://Murach/Ch03Cart/Order.aspx

    If you haven’t already tested an application from within Visual Studio in each browser that might be used to run the application, you should do that from outside Visual Studio. In addition, if the application retrieves and updates data in a database, you’ll want to test it simultaneously in two browser windows. To understand why, you need to realize that after an application retrieves data from a database, it closes the connection to the database. Because of that, two or more users can retrieve the same data at the same time. This is called concurrency, and it can cause concurrency errors when the data is updated.

    In section 3 of this book, you’ll learn more about concurrency and how you avoid concurrency errors. For now, you should just realize that you’ll need to test your applications to be sure that they handle concurrency problems.

    The Order page displayed in a Mozilla Firefox browser outside of Visual Studio


    Figure 4-7.  How to test an application from outside of Visual Studio

    Description

    1. You can run any IIS application from outside of Visual Studio. To do that, open the browser you want to use, enter the URL for the starting page of the application as shown above, and press Enter.
    2. When you run an application from outside of Visual Studio, you can run it in two or more browser windows simultaneously. That way, you can be sure that the application provides for any concurrency errors that can occur.
    3. If you want to use the debugger while testing for concurrency errors, you can run one instance of the application from within Visual Studio with debugging, and you can run another instance from outside of Visual Studio.

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This article is an excerpt from the book "Murach's ASP.NET 2.0 Web Programming with...
     

    Buy this book now. This article is excerpted from chapter four of the book Murach's ASP.NET 2.0 Web Programming with VB 2005, written by Joel Murach and Anne Boehm (Murach, 2006; ISBN: 1-890774-32-4). Buy this book now.

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek