Walkthrough: Creating a Simple Web App

In this walkthrough, you will create a simple Web app to use as the basis for a Web performance test in Walkthrough: Recording and Running a Web Performance Test.

You’ll perform the following tasks:

  • Create a simple Web app.

  • Test the Web app manually.

Here’s what you’ll need:

  • Visual Studio Ultimate

To create the Web app

  1. In Visual Studio Ultimate, on the FILE menu, choose New and then choose Project.

    The New Project dialog box appears.

  2. Under Installed templates, expand the programming language that you prefer and then choose Web.

  3. In the list of Web project types, select ASP.NET Empty Web Application.

    NoteNote

    You will write minimal code in this walkthrough.

  4. In the Name box, type ColorWebApp.

  5. In the Location box, specify the folder where you want to create your Web app.

  6. Select Create directory for solution.

  7. Choose OK.

  8. In Solution Explorer, verify that the new ColorWebApp project is selected.

  9. On the PROJECT menu, choose Add New Item.

    The Add New Item dialog box appears.

  10. In the list of items, choose Web Form.

  11. In the Name text box, type Default.aspx and then choose Add.

To add controls to the Web app

  1. In Solution Explorer, right-click Default.aspx and choose View Designer.

    A blank page is displayed.

  2. If the toolbox is not visible, from the VIEW menu choose Toolbox.

  3. From the Standard group, drag a RadioButtonList onto the page.

    A RadioButtonList control is added to the design surface.

  4. Expand the RadioButtonList Tasks action tag pane, and choose the EditItems link.

    A ListItem Collection Editor appears.

    NoteNote

    You can also display the ListItem Collection Editor by editing the Items collection on the Properties window.

  5. Choose Add to add a new item.

  6. Under ListItem properties:

    1. Change the Text property to Red.

    2. Set the Selected property to True.

  7. Choose Add to add another item.

  8. Under ListItem properties change the Text property to Blue.

  9. Choose OK to close the ListItem Collection Editor.

  10. From the toolbox, drag a Button onto the page and in the Properties window, change the Text property to Submit.

  11. On the FILE menu, choose Save All.

To add pages to the Web app

  1. On the PROJECT menu, choose Add New Item.

  2. In the Add New Item dialog box, select Web Form from the list of templates, and in Name type Red.aspx. Then choose Add.

  3. At the bottom of the document window, choose the Design tab to switch to design view.

  4. Drag a Label onto the page. In the Properties window, set the Text property to Red, and the ForeColor property to Red.

  5. On the PROJECT menu, choose Add New Item.

  6. In the Add New Item dialog box, choose the Web Form template, name it Blue.aspx, and then choose Add.

  7. At the bottom of the document window, choose the Design tab to switch to design view.

  8. Drag a Label onto the page. In the Properties window, set the Text property to Blue, and the ForeColor property to Blue.

  9. On the FILE menu, choose Save All.

To add functionality to the Web app

  1. In Solution Explorer right-click Default.aspx and choose View Designer.

  2. Double-click the Submit Button. Visual Studio switches to the page code, and creates a skeleton event handler for the Button control's Click event.

  3. Add the following code to the event handler:

    if (this.RadioButtonList1.SelectedValue == "Blue")
    {
        Response.Redirect("Blue.aspx");
    }
    else
    {
        Response.Redirect("Red.aspx");
    }
    

    If RadioButtonList1.SelectedValue = "Blue" Then
        Response.Redirect("Blue.aspx")
    Else
        Response.Redirect("Red.aspx")
    End If
    

  4. On the FILE menu, choose Save All.

To test the Web app manually

  1. In Solution Explorer, right-click Default.aspx and then choose Set As Start Page.

  2. Press CTRL+F5 to run the Web app in the browser. You will see the first page.

  3. Choose Red and then choose Submit. If the app is working correctly you will go to the page with the Label that says Red.

  4. Go back to the first page.

  5. Choose Blue and then choose Submit. If the app is working correctly you will go to the page with the Label that says Blue.

In this walkthrough you created a simple Web app and tested it manually. Now you are ready to create a Web Performance Test that lets you test this app. See Walkthrough: Recording and Running a Web Performance Test.

Show: