Click here to Skip to main content
15,896,557 members
Articles / Web Development / HTML

Gallery Server Pro - An ASP.NET Gallery for Sharing Photos, Video, Audio and Other Media

Rate me:
Please Sign up or sign in to vote.
4.86/5 (131 votes)
18 Oct 2013GPL331 min read 829.9K   539  
Gallery Server Pro is a complete, stable ASP.NET gallery for sharing photos, video, audio and other media. This article presents the overall architecture and major features.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<configSections>
		<sectionGroup name="system.web">
			<section name="galleryServerPro" type="GalleryServerPro.Configuration.GalleryServerProConfigSettings, GalleryServerPro.Configuration" allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false" />
		</sectionGroup>
		<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching" requirePermission="false" />
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>

	<connectionStrings>
		<clear />
		<add name="SQLiteDbConnection" connectionString="Data Source=|DataDirectory|galleryserverpro_data.sqlite;Version=3;" />
		<add name="SqlServerDbConnection" connectionString="Data Source=(local);Initial Catalog=GalleryServerPro;Integrated Security=true;Application Name=Gallery Server Pro" />
	</connectionStrings>

	<cachingConfiguration defaultCacheManager="Cache Manager">
		<cacheManagers>
			<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="Null Storage" name="Cache Manager" />
		</cacheManagers>
		<backingStores>
			<add encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching" name="Null Storage" />
		</backingStores>
	</cachingConfiguration>

	<appSettings />

	<system.web>
		<machineKey
 validationKey="B6AF9388159183B6A8EE690C851398A11997C519F859599459E30121EF4DF8BF2B1666BC82BB6FEB2FEF279BEB325E897AED6EA5B71C55D213B76510EF96CAA8"
 decryptionKey="3C5EF273A20ED2473594C9691627700A79376A7C1455320A"
 validation="SHA1" />

		<pages theme="HelixBlue" styleSheetTheme="">
			<controls>
				<add tagPrefix="CA" namespace="ComponentArt.Web.UI" assembly="ComponentArt.Web.UI" />
				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
			</controls>
		</pages>

		<galleryServerPro configSource="config\galleryserverpro.config" />

		<!-- <trust level="Full"/> -->

		<globalization uiCulture="auto:en" culture="auto:en-US" />

		<xhtmlConformance mode="Strict" />

		<compilation debug="false">
			<assemblies>
				<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			</assemblies>
		</compilation>

		<!-- The <authentication> section enables configuration of the security authentication mode used by 
         ASP.NET to identify an incoming user.
				The timeout is set to 129,600 minutes by default, which is 90 days. This allows the user to be automatically 
				logged in (requires selecting the "Remember Me" checkbox during login which sets a persistent cookie).
				Note that when the user clicks "Log out", the persistent cookie is removed and the user will have to 
				log in next time. -->
		<authentication mode="Forms">
			<forms loginUrl="login.aspx" defaultUrl="default.aspx" protection="All" timeout="129600" slidingExpiration="true" />
		</authentication>

		<authorization>
			<!--  <deny users="?" />-->
		</authorization>

		<!-- Configure the Membership provider.-->
		<membership defaultProvider="SQLiteMembershipProvider">
			<providers>
				<clear />
				<add applicationName="Gallery Server Pro" passwordFormat="Clear"
				 minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2"
				 maxInvalidPasswordAttempts="2" enablePasswordReset="true" enablePasswordRetrieval="true"
				 passwordAttemptWindow="10" requiresQuestionAndAnswer="false"
				 requiresUniqueEmail="false" connectionStringName="SQLiteDbConnection"
				 name="SQLiteMembershipProvider" type="GalleryServerPro.Data.SQLite.SQLiteMembershipProvider" />
				<add applicationName="Gallery Server Pro" passwordFormat="Encrypted"
				 minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2"
				 maxInvalidPasswordAttempts="50" enablePasswordReset="true" enablePasswordRetrieval="true"
				 passwordAttemptWindow="10" requiresQuestionAndAnswer="false"
				 requiresUniqueEmail="false" connectionStringName="SqlServerDbConnection"
				 name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" />
			</providers>
		</membership>

		<!-- Configure the Role provider.-->
		<roleManager enabled="true" cacheRolesInCookie="true" cookieProtection="Validation"
   defaultProvider="SQLiteRoleProvider">
			<providers>
				<clear />
				<add applicationName="Gallery Server Pro" connectionStringName="SQLiteDbConnection"
				 name="SQLiteRoleProvider" type="GalleryServerPro.Data.SQLite.SQLiteRoleProvider" />
				<add applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection"
				 name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
			</providers>
		</roleManager>

		<!-- Configure the Profile provider.-->
		<profile defaultProvider="SQLiteProfileProvider">
			<providers>
				<clear />
				<add applicationName="Gallery Server Pro" connectionStringName="SQLiteDbConnection"
				 name="SQLiteProfileProvider" type="GalleryServerPro.Data.SQLite.SQLiteProfileProvider" />
				<add applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection"
				 name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" />
			</providers>
			<properties>
				<add name="ShowMediaObjectMetadata" defaultValue="false" type="String"
				 allowAnonymous="true" />
			</properties>
		</profile>

		<anonymousIdentification enabled="true" />

		<httpHandlers>
			<remove verb="*" path="*.asmx" />
			<add verb="*" path="ComponentArtUploadProgress.axd" type="ComponentArt.Web.UI.UploadProgressHandler, ComponentArt.Web.UI" />
			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
		</httpHandlers>

		<httpModules>
			<add name="ComponentArtUploadModule" type="ComponentArt.Web.UI.UploadModule, ComponentArt.Web.UI" />
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
		</httpModules>

		<sessionState mode="InProc" timeout="60" />

		<!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs.
			The mode attribute must be one of these values: Off (No redirection is performed; all users get detailed
			error message), On (all users are redirected to friendly error page), RemoteOnly (local users see detailed
			error message, remote users are redirected) -->
		<customErrors mode="RemoteOnly" defaultRedirect="error/error.aspx">
			<error statusCode="403" redirect="error/error_404.aspx" />
			<error statusCode="404" redirect="error/error_404.aspx" />
		</customErrors>

		<!-- Enable / disable tracing. -->
		<trace enabled="false" pageOutput="false" localOnly="false" mostRecent="true" writeToDiagnosticsTrace="false" requestLimit="200" />

		<!-- Gallery Server 1.x had the home page at index.aspx, so provide automatic redirection if users had 
		a bookmark to the old location. -->
		<urlMappings enabled="true">
			<add url="~/index.aspx" mappedUrl="~/default.aspx" />
		</urlMappings>

	</system.web>

	<!-- The maxRequestLength attribute specifies the maximum upload size (KB).
	To prevent requests larger than 2 GBytes, use maxRequestLength="2097151" The executionTimeout
	attribute specifies the maximum number of seconds a request is allowed to execute before being 
	automatically shut down by ASP.NET. For 8 hours, use executionTimeout="28800". -->
	<location path="task/addobjects.aspx">
		<system.web>
			<httpRuntime maxRequestLength="2097151" executionTimeout="28800" />
		</system.web>
	</location>

	<location path="task/synchronize.aspx">
		<system.web>
			<httpRuntime executionTimeout="86400" />
		</system.web>
	</location>

	<location path="task/transferobject.aspx">
		<system.web>
			<httpRuntime executionTimeout="3600" />
		</system.web>
	</location>

	<location path="admin/backup-restore.aspx">
		<system.web>
			<httpRuntime executionTimeout="3600" />
		</system.web>
	</location>

	<system.diagnostics>
		<switches>
			<!--0 = Off,  1 = Error, 2 = Warning, 3 = Info, 4 = Verbose -->
			<add name="TraceLevelSwitch" value="0" />
		</switches>
		<trace autoflush="true" indentsize="2">
			<listeners>
				<!-- <add name="WebPageTraceListener" type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
				<clear/>
				Use clear in non-Full trust environments, or delete tracing altogeter -->
			</listeners>
		</trace>
	</system.diagnostics>

	<system.web.extensions>
		<scripting>
			<webServices>
				<profileService enabled="true" readAccessProperties="ShowMediaObjectMetadata" writeAccessProperties="ShowMediaObjectMetadata" />
				<jsonSerialization maxJsonLength="2147483647" />
			</webServices>

			<scriptResourceHandler enableCompression="true" enableCaching="true" />
		</scripting>
	</system.web.extensions>

	<system.webServer>
		<!-- By default IIS 7 restricts uploads larger than about 30 MB. To allow larger uploads, use the <requestFiltering>
			element to set a new value. The attribute maxAllowedContentLength is in bytes, so to set a new value of 2 GB,
			use 2147483648 (2 * 1024 * 1024 * 1024).
			Note: If you get an error that requestFiltering cannot be overriden you must edit 
			%windir%\System32\inetsrv\config\applicationHost.config file and change the string:
				<section name="requestFiltering" overrideModeDefault="Deny" />
			to:
				<section name="requestFiltering" overrideModeDefault="Allow" />

		<security>
			<requestFiltering>
				<requestLimits maxAllowedContentLength="2147483648"/>
			</requestFiltering>
		</security>
		-->
		<validation validateIntegratedModeConfiguration="false" />
		<modules>
			<remove name="ScriptModule" />
			<add name="ComponentArtUploadModule" type="ComponentArt.Web.UI.UploadModule, ComponentArt.Web.UI" />
			<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
		</modules>
		<handlers>
			<remove name="WebServiceHandlerFactory-Integrated"/>
			<remove name="ScriptHandlerFactory" />
			<remove name="ScriptHandlerFactoryAppServices" />
			<remove name="ScriptResource" />
			<add name="ComponentArtUpload" verb="*" path="ComponentArtUploadProgress.axd" type="ComponentArt.Web.UI.UploadProgressHandler, ComponentArt.Web.UI" />
			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
			<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
		</handlers>
		<defaultDocument>
			<files>
				<clear />
				<add value="default.aspx" />
			</files>
		</defaultDocument>
	</system.webServer>
</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, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior) Tech Info Systems
United States United States
I have nearly 20 years of industry experience in software development, architecture, and Microsoft Office products. My company Tech Info Systems provides custom software development services for corporations, governments, and other organizations. Tech Info Systems is a registered member of the Microsoft Partner Program and I am a Microsoft Certified Professional Developer (MCPD).

I am the creator and lead developer of Gallery Server Pro, a free, open source ASP.NET gallery for sharing photos, video, audio, documents, and other files over the web. It has been developed over several years and has involved thousands of hours. The end result is a robust, configurable, and professional grade gallery that can be integrated into your web site, whether you are a large corporation, small business, professional photographer, or a local church.

Comments and Discussions