|
Imports System
Imports System.Configuration
Imports System.Text.RegularExpressions
Namespace Ventaur.Web.Security.Configuration
''' <summary>
''' Indicates the type of security for a file or directory.
''' </summary>
Public Enum SecurityType
''' <summary>
''' The item should be secure.
''' </summary>
Secure
''' <summary>
''' The item should be insecure.
''' </summary>
Insecure
''' <summary>
''' The item should be ignored.
''' </summary>
Ignore
End Enum
''' <summary>
''' Represents an file or directory entry in the <secureWebPages>
''' configuration section.
''' </summary>
Public MustInherit Class SecureWebPageItemSetting
Inherits ConfigurationElement
#Region "Constructors"
''' <summary>
''' Creates an instance of SecureWebPageItemSetting.
''' </summary>
Public Sub New()
MyBase.New()
End Sub
''' <summary>
''' Creates an instance with an initial path value.
''' </summary>
''' <param name="path">The relative path to the file.</param>
Public Sub New(ByVal path As String)
Me.New()
Me.Path = path
End Sub
''' <summary>
''' Creates an instance with initial values.
''' </summary>
''' <param name="path">The relative path to the file.</param>
''' <param name="secure">The type of security for the file.</param>
Public Sub New(ByVal path As String, ByVal secure As SecurityType)
Me.New(path)
Me.Secure = secure
End Sub
#End Region
#Region "Properties"
''' <summary>
''' Gets or sets the path of this item.
''' </summary>
<ConfigurationProperty("path", IsRequired:=True, IsKey:=True)> _
Public Overridable Property Path() As String
Get
Return CStr(Me("path"))
End Get
Set(ByVal value As String)
Me("path") = value
End Set
End Property
''' <summary>
''' Gets or sets the type of security for this item.
''' </summary>
<ConfigurationProperty("secure", DefaultValue:=SecurityType.Secure)> _
Public Property Secure() As SecurityType
Get
Return CType(Me("secure"), SecurityType)
End Get
Set(ByVal value As SecurityType)
Me("secure") = value
End Set
End Property
#End Region
End Class
''' <summary>
''' Represents a collection of SecureWebPageItemSetting objects.
''' </summary>
Public MustInherit Class SecureWebPageItemSettingCollection
Inherits ConfigurationElementCollection
''' <summary>
''' Returns the index of a specified item in the collection.
''' </summary>
''' <param name="item">The item to find.</param>
''' <returns>Returns the index of the item.</returns>
Public Function IndexOf(ByVal item As SecureWebPageItemSetting) As Integer
If Not item Is Nothing Then
Return BaseIndexOf(item)
Else
Return -1
End If
End Function
''' <summary>
''' Returns the index of an item with the specified path in the collection.
''' </summary>
''' <param name="Path">The path of the item to find.</param>
''' <returns>Returns the index of the item with the path.</returns>
Public Function IndexOf(ByVal path As String) As Integer
Return Me.IndexOf(CType(BaseGet(path.ToLower()), SecureWebPageItemSetting))
End Function
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.
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).