Click here to Skip to main content
15,894,405 members
Articles / Programming Languages / C#

Application Configuration Editor using the PropertyGrid

Rate me:
Please Sign up or sign in to vote.
4.80/5 (35 votes)
1 Mar 20045 min read 192.2K   5.9K   118  
An application configuration editor using the PropertyGrid control.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<configSections>
		<section name="CommonConfiguration" type="Photos.Common.SystemFramework.CommonConfiguration, Photos.Common.SystemFramework"/>
		<section name="ApplicationConfiguration" type="Photos.Net.Common.PhotosConfig, Photos.Net.Common"/>
	</configSections>
	<system.web>
		<!--identity impersonate="True" - switch this to ON if you want to create an event source from an ASP.Net page in this site-->
		<customErrors defaultRedirect="errorpage.aspx" mode="RemoteOnly"/>
		<compilation defaultLanguage="c#" debug="True"/>
		<!-- The sessionState is currently set to inproc:  the lines following [mode="inproc"] are not used but are present for ease of configuration -->
		<sessionState cookieless="False" timeout="20" mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password="/>
		<globalization fileEncoding="utf-8" responseEncoding="utf-8" requestEncoding="utf-8"/>
		<!--<globalization responseEncoding="iso-8859-1" requestEncoding="iso-8859-1" />-->
		<!-- security -->
		<authentication mode="Forms">
			<forms name=".PHOAUTH" loginUrl="system\secure\logon.aspx" protection="All"></forms>
		</authentication>
		<authorization>
			<allow users="?"/>
		</authorization>
		<trace enabled="False" requestLimit="100" pageOutput="False" traceMode="SortByTime" localOnly="False"/>
		<httpHandlers>
			<add verb="*" path="*.jpeg" type="Photos.Net.Web.PhotoHandler,Photos.Net.Web"/>
			<!--We're back to using the zip handler thanks to yet another bug in Internet Explorer for the Macintosh-->
			<add verb="*" path="*.zip" type="Photos.Net.Web.ZipHandler,Photos.Net.Web"/>
		</httpHandlers>
	</system.web>
	<ApplicationConfiguration>
		<!-- Settings specific to the Photos application -->		
		<!-- Our site Up, Down Soft, Down Hard enumeration
			 This will show the sitedown.aspx page if the site is down for maintenance.
			 Down soft will wait for sessions to expire. Down hard ends all the curent 
			 session immediately. See Global.asax.cs for the code.
             1 = Up
             2 = Down Soft (wait for sessions to end)
             3 = Down Hard (down immiediately-->
		<add key="Photos.Net.Common.SiteStatus" value="1" description="Site status controls the availability of the Web site. 1 = up, 2 = down soft, 3= down hard."/>
		<!--The key below will set the system to either Production view or Online view
			Production view shows all records with country and keywords regardless of their status.
			Online view changes the SPROC used for QuickSearch to use the product table view that
			will only show picutures that have been set to status 'Publish' and not 'Recall' -->
		<add key="Photos.Net.Common.UsePublishedView" value="False" description="Using published view will only allow pictures that have been published to be found. For the in-house production system this should be False so that work in progress can be viewed."/>
		<!--Database connection strings. PhotosConfig looks for the word Dev or Test in the current directory
		    and chooses the correct connection string as a result-->	
		<add key="Photos.Net.Common.ContentConnectionString" value="server=PSRV02;User ID=Someuser;Password=somepassword;database=content;Connection Reset=FALSE" description="Production content database connection string."/>
		<add key="Photos.Net.Common.CommerceConnectionString" value="server=PSRV02;User ID=Someuser;Password=somepassword;database=commerce;Connection Reset=FALSE" description="Production commerce database connection string."/>		
		<!--Other keys -->
		<add key="Photos.Net.Common.ImageHandler" value="True" description="Determines whether to use the HTTP Handler for image processing."/>
		<add key="Photos.Net.Common.PrethumbServerInside" value="http://192.168.1.100/prethumb/" description="Prethumb server address for internal image relaying."/>
		<add key="Photos.Net.Common.PrethumbServerOutside" value="http://192.168.1.100/prethumb/" description="Prethumb server address for external image relaying."/>
		<!--Download server is the server used to relay the Zip packages from behind the firewall
			Look at download.aspx.cs to see how this works -->
		<add key="Photos.Net.Common.DownloadServer" value="http://192.168.1.3/download/" description="Address for download packages."/>
		<add key="Photos.Net.Web.BrowserRedirection" value="True" description="Don't allow downlevel browser on to the site."/>
		<add key="Photos.Net.Web.EnablePageCache" value="True"/>
		<add key="Photos.Net.Web.PageCacheExpiresInSeconds" value="3600"/>
		<add key="Photos.Net.Web.EnableSsl" value="False" description="SSL switch for SecureBase Url - True enables SSL on the site."/>
		<add key="Photos.Net.Web.InvoiceDirectory" value="D:\Photos-Invoices\"/>
		<add key="Photos.Net.Common.SystemEmail" value="AsiaWorks Photography &lt;online@asiaworksphotos.com&gt;"/>
		<add key="Photos.Net.Common.SmtpServer" value="smtp.pacific.net.th"/>
	</ApplicationConfiguration>
	<CommonConfiguration>
		<!-- Trace file settings -->
		<add key="SystemFramework.Tracing.Enabled" value="False"/>
		<!-- Set this to the file with the trace settings. This file should be relative
             to the root application directory. -->
		<add key="SystemFramework.Tracing.TraceFile" value="Photos.txt"/>
		<!-- The TraceLevel for this switch.  -->
		<add key="SystemFramework.Tracing.TraceLevel" value="4"/>
		<!-- This switch name. The trace level for this name can be set through
             environment variables or the registry  -->
		<add key="SystemFramework.Tracing.SwitchName" value="PhotosTraceSwitch"/>
		<!-- This description of the Tracing.SwitchName switch -->
		<add key="SystemFramework.Tracing.SwitchDescription" value="Error and information tracing for Photos.Net"/>
		<!-- Event log settings
			Note: The default Photos.Net event source name is created in the local machine during setup. 
			If you wish to log events to a different event source that event source must exist.
        -->
		<add key="SystemFramework.EventLog.Enabled" value="True"/>
		<add key="SystemFramework.EventLog.Machine" value="."/>
		<add key="SystemFramework.EventLog.SourceName" value="Photos.Net"/>
		<!-- Use the standard TraceLevel values:
             0 = Off
             1 = Error
             2 = Warning
             3 = Info
             4 = Verbose -->
		<add key="SystemFramework.EventLog.LogLevel" value="4"/>
	</CommonConfiguration>		
	<appSettings>
	<!--The section below is particulary important as it holds the addresses of our Webservices. 
		This section is created automatically when the URL property of the Web service is 
		set to dynamic -->
	<!-- Section and setting created by VS.Net for our WebServices URLs. -->	
		<add key="Photos.Net.Web.Orders.OrderService" value="http://localhost/photos.orders/orderservice.asmx"/>
		<add key="Photos.Net.Web.Packages.PackageService" value="http://localhost/photos.package/packageservice.asmx"/>
	</appSettings>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Thailand Thailand
I've been working in IT for about 14 years. Started in general support, networking and later specialized in publishing and editorial system networks.

Made the switch to full-time software development only about 5 years ago - mainly C#, VB and SQLServer. C# and ASP.Net for two years now and I love it.

Comments and Discussions