1 / 13

COMP6325 Advanced Web Technologies

COMP6325 Advanced Web Technologies. Dr. Paul Walcott The University of the West Indies Session 4 – Building Enterprise-scale Web-based Applications – Part III : Configuring ASP.NET Spring 2009. Objectives. At the end of this session the student shall be able to:

jackie
Télécharger la présentation

COMP6325 Advanced Web Technologies

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMP6325 Advanced Web Technologies Dr. Paul Walcott The University of the West Indies Session 4 – Building Enterprise-scale Web-based Applications – Part III : Configuring ASP.NET Spring 2009

  2. Objectives • At the end of this session the student shall be able to: • Describe how ASP.NET applications are configured • Add a custom setting

  3. An ASP.NET application comprises of (MacDonald 2007, p. 130):

  4. The configuration files in ASP.NET… • Configure the way error messages are shown • Configure security settings • Allow users to add custom settings • And much, much more.

  5. The advantage of these configuration files include (McDonald 2007): • They are never locked therefore can be updated at any time • They can be accessed easily • These files are easy to edit since they are in XML

  6. The main configuration files are: • web.config • machine.config

  7. What does the web.config file look like (McDonald 2007)? <xml version=“1.0” ?> <configuration> <configSections>…</configSections> <appSettings>… </appSettings <connectionStrings>… </connectionStrings> <system.web>… </system.web> <system.codedom>… </system.codedom> <system.webServer>…</system.webServer> </configuration>

  8. Which sections of web.config are most important? • <appSettings> • Allows storage of custom settings • <connectionStrings> • Database connection information • <system.web> • The ASP.NET settings; for example <authentication> and <authorization>

  9. Machine configuration files • Every web server starts with basic settings. These are defined in the machine.config and web.config files, located at: • c:\Windows\Microsoft.NET\Framework\v2.0.50727\Config • These settings affect the entire system • For application level settings use web.config • Which will be in the root of the virtual directory of the application

  10. This is how you add a custom setting to the web.config file <appSettings> <add key”ImageFilesPath” value=“/pictures/images” /> </appSettings>

  11. The custom setting can be queried using WebConfigurationManager using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Configuration; Public partial class QuerySettings : System.Web.UI.Page { protected void Page_Load() { lblMyImagesPath = “My images are in” + WebConfigurationManager.AppSettings[“ImageFilesPath”]; } }

  12. Conclusion • In this session • The method used to configure ASP.NET was described

  13. References MacDonald, M., “Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional”, Apress, Second Edition, 2007

More Related