Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.

Similar presentations


Presentation on theme: "© 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University."— Presentation transcript:

1 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott 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 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott 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 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott An ASP.NET application comprises of (MacDonald 2007, p. 130) :

4 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott 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 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott 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 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott The main configuration files are:  web.config  machine.config

7 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott What does the web.config file look like (McDonald 2007) ? … … </appSettings …

8 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott Which sections of web.config are most important?  Allows storage of custom settings  Database connection information  The ASP.NET settings; for example and

9 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott 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.507 27\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 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott This is how you add a custom setting to the web.config file <add key”ImageFilesPath” value=“/pictures/images” />

11 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott 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[“ImageFilesPa th”]; }

12 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott Conclusion  In this session The method used to configure ASP.NET was described

13 © 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott References MacDonald, M., “Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional”, Apress, Second Edition, 2007


Download ppt "© 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University."

Similar presentations


Ads by Google