Click here to Skip to main content
15,884,537 members
Articles / Web Development / ASP.NET

Switching Between HTTP and HTTPS Automatically: Version 2

Rate me:
Please Sign up or sign in to vote.
4.91/5 (223 votes)
7 Feb 2011CPOL18 min read 3.5M   680  
An article on automatically switching between HTTP and HTTPS protocols without hard-coding absolute URLs
Imports System
Imports System.Web
Imports Ventaur.Web.Security.Configuration

Namespace Ventaur.Web.Security

	''' <summary>
	''' Defines the arguments used for the EvaluateRequest event.
	''' </summary>
	''' <remarks></remarks>
	Public Class EvaluateRequestEventArgs

		' Fields.
		Private _application As HttpApplication
		Private _cancelEvaluation As Boolean = False
		Private _settings As SecureWebPageSettings


		''' <summary>
		''' Gets the HttpApplication used to evaluate the request.
		''' </summary>
		Public ReadOnly Property Application() As HttpApplication
			Get
				Return _application
			End Get
		End Property

		''' <summary>
		''' Gets or sets a flag indicating whether or not to cancel the evaluation.
		''' </summary>
		Public Property CancelEvaluation() As Boolean
			Get
				Return _cancelEvaluation
			End Get
			Set(ByVal value As Boolean)
				_cancelEvaluation = value
			End Set
		End Property

		''' <summary>
		''' Gets the SecureWebPageSettings used to evaluate the request.
		''' </summary>
		Public ReadOnly Property Settings() As SecureWebPageSettings
			Get
				Return _settings
			End Get
		End Property

		''' <summary>
		''' Creates an instance of EvaluateRequestEventArgs with an instance of SecureWebPageSettings.
		''' </summary>
		''' <param name="application">The HttpApplication for the current context.</param>
		''' <param name="settings">An instance of SecureWebPageSettings used for the evaluation of the request.</param>
		Public Sub New(ByVal application As HttpApplication, ByVal settings As SecureWebPageSettings)
			MyBase.New()
			_application = application
			_settings = settings
		End Sub

	End Class

End Namespace

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 Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I began programming on my Commodore 64 at around the age of 12. After migrating to DOS and then Windows, I decided to take on the Web. Several languages and platforms later, I have settled in with .NET nicely. I am currently the owner of a software consulting company and lead application developer for a learning-based technology consultation company.

The love of a finished application is usually at war with the desire to improve it as soon as it's released (they're never really finished).

Comments and Discussions