Imports System.Configuration
Imports System.Web.Configuration

'Web.Configの設定情報のクラス

Public Class ConfigSettings
    Public Shared ReadOnly Property MaxFileSize As Integer
        Get
            Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration("~")
            Dim section As HttpRuntimeSection = CType(config.GetSection("system.web/httpRuntime"), HttpRuntimeSection)
            Return section.MaxRequestLength * 1024 ' KBをバイトに変換
        End Get
    End Property

    Public Shared ReadOnly Property MaxFileSizeInMB As Integer
        Get
            Return MaxFileSize \ (1024 * 1024) ' バイトをMBに変換
        End Get
    End Property
End Class
