//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;
using CommunityServer.Configuration;

namespace CommunityServer.Controls
{
	/// <summary>
	/// Summary description for SecureTemplatedWebControl.
	/// </summary>
	public abstract class SecureTemplatedWebControl : TemplatedWebControl
	{
		public SecureTemplatedWebControl()
		{
			Globals.ValidateSecureConnection(SSLSettings.Password, Context);
		}

		protected void LeaveSecureConnection(string url)
		{
			if(Context.Request.IsSecureConnection && CSConfiguration.GetConfig().SSL != SSLSettings.All)
				url = string.Format("http://{0}{1}", Context.Request.Url.Host,url);

			Context.Response.Redirect(url,true);
			
		}
	}
}
