5.4. Testing the Application

With the entire application built, it is now time to test it out.

  1. To get started, select Main.aspx in Solution Explorer and then press F5 to debug the application.

  2. In Main.aspx, add a few items into the shopping cart, as shown in Figure 5-26.

    Figure 5-26. Adding items to a shopping cart and then checking out

  3. When you are done adding the items, click the Checkout button and you will be redirected to the Login.aspx page (see Figure 5-27).

  4. Since you have not registered for an account yet, click on the "here" link to load the Register.aspx page (see Figure 5-28). Enter the required information and click Create User.

    You should use a strong password consisting of a mixture of alphanumeric values and special characters. For example, you can use password such as pass@word1. ASP.NET 2.0 requires passwords to have a mixture of numerals (0 9), letters (a z, A Z), and special characters (such as # and !). It will also reject passwords that are less than seven characters.

    Default Login Page

    Wait a minute, how does ASP.NET know that it should load the Login.aspx page to authenticate the user when the Checkout button is clicked, rather than the other pages?

    Well, in ASP.NET 2.0, a page with the filename Login.aspx is deemed to be the login page when users try to access restricted folders (Members, in this case). This special name Login.aspx (plus many others) is "burned" into ASP.NET as a default.

    The machine.config.default file (located in C:\WINDOWS\Microsoft.NET\Framework\<version>\CONFIG) contains all the default system-wide configuration settings. To see the default settings defined in machine.config.default, check the machine.config.comments file (also in the same directory) for details.

    For example, the default settings for Forms authentication found in machine.config.comments are:

     <forms     name=".ASPXAUTH"     loginUrl="login.aspx"     protection="All"     timeout="30"     path="/"     requireSSL="false"     slidingExpiration="true"     defaultUrl="default.aspx"     cookieless="UseCookies"     enableCrossAppRedirects="false" > 

    If you want to override the default settings, you should modify machine.config (for machine-wide configuration) or Web.config (for application-wide configuration). The rationale for splitting the original machine.config file into three different files is to reduce the size of machine.config and hence improve performance.

  5. If the registration is successful, you will see the page shown in Figure 5-29. Click Continue to return to the Main.aspx page.

  6. In Main.aspx, if you now click on the Checkout button, you will be redirected to the Checkout.aspx page (see Figure 5-30). All the items that you have added before you log in are now displayed in the GridView control. You can click on the Continue Shopping link to return to Main.aspx to continue adding items into your shopping cart.

    Figure 5-27. The Login.aspx page

    Figure 5-28. The Register.aspx page

    Figure 5-29. Registration successful

    Figure 5-30. The Checkout.aspx page

Visual Basic 2005 Jumpstart 2005
Visual Basic 2005 Jumpstart
ISBN: 059610071X
EAN: 2147483647
Year: 2005
Pages: 86
Authors: Wei-Meng Lee

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net