Though simple, the ASP.NET "Hello World" application demonstrates the essential steps for creating an ASP.NET application. The application uses a Web Form, controls, and an event that will display a result in response to a user action.
To create an ASP.NET project
- Create a new ASP.NET project by clicking File
New
ASP.NET Web Application. The New ASP.NET Web Application dialog box appears.
- In the Name field, enter HelloWorld for the application name.
- In the Location field, accept the default or enter another path.
To change Web server settings (optional)
- In the New ASP.NET Web Application dialog box, click View Server Options. The dialog expands to show additional server options.
- Set the various read and write attributes of the project as needed or accept the defaults.
Tip: For most ASP.NET projects, the default settings will suffice.
- Click OK. The Web Forms Designer appears.
To create the ASP.NET page
- If necessary, click Design view.
- From the Web Controls category of the Tool Palette, drag a Button component onto the Designer surface. The Button control appears on the Designer. Make sure the control is selected.
- In Object Inspector, set the Text property to Hello, world!.
To associate code with the button control
- In the Designer, double-click the Button control. The code-behind Designer appears, cursor in place between event handler brackets.
- Code the application logic:
button1.Text = "Hello, developer!";
button1.Text := 'Hello, developer!';
- Choose File
Save to save the application.
To run the "Hello World" application
- Choose Run
Run. The application compiles and the HTTP server displays a Web Form in your default browser with the "Hello, world!" button.
- Click the "Hello, world!" button. The server updates the page with the response, "Hello, developer!".
- Close the Web browser to return to the IDE.