Programming Microsoft Web Forms (Pro Developer)
One page remains in the administration tool. Click the Application tab to see a page similar to the one shown in Figure 7-16.
The Application Settings section allows you to create and mangage application settings. Application settings consist of a key and value pair. For instance, you might have a setting that lists the number of blog entries to show on a page, for which the key would be "NumberOfBlogEntries" and the value would be "4". Application settings are stored in the Web.config file and can be accessed by using the ConfigurationSettings class, as shown here.
int32 PageSize=0; int32.TryParse(ConfigurationSettings.AppSettings["NumberOfBlogEntries"], out PageSize);
Tip | Here I am using the new TryParse method of the int32 class. In earlier versions of the Microsoft .NET Framework, you had to attempt the parse of a string containing an integer inside a try/catch block. The TryParse method, which was available for doubles and DateTime objects (and a few other classes) in earlier versions of .NET, is now available for integer classes in .NET 2.0. Note that the PageSize parameter is passed as an out parameter, and the TryParse method returns not the number, but a bool value that indicates whether the string can be parsed as an integer. |
A feature of the login and registration controls that will be covered in the next section is the ability to e-mail users when they have forgotten their passwords. Clicking the Configure SMTP E-Mail Settings link opens the page shown in Figure 7-17, which allows you to set up a Simple Mail Transfer Protocol (SMTP) server.
Other options on the Application page allow you to configure debugging and tracing, as well as take the application offline.