HttpCookiesSection クラス
アセンブリ: System.Web (system.web.dll 内)


HttpCookiesSection クラスを使用すると、構成ファイルの httpCookies セクションにプログラムからアクセスして変更できます。
既定では、このクラスは、アプリケーションによって実行されるすべての Cookie に対して適用される設定を定義します。ただし、Cookie を発行するコードがこの設定をオーバーライドする場合もあります。
httpCookies 要素には、HttpOnly Cookie の使用をサポートするという目的があります。HttpOnly Cookie (HttpOnly 属性を持つ Cookie) は、クロスサイト スクリプティングのリスクを軽減するために Internet Explorer 6 で導入されました。HttpOnly 属性を持つ Cookie には、クライアント側のスクリプトからアクセスできません。これにより、HttpOnly Cookie に格納されている情報は、ハッカーや悪意ある Web サイトから読み取られにくくなります。詳細については、MSDN (msdn.microsoft.com) で "HttpOnly" を検索してください。
![]() |
---|
HttpCookiesSection は、値が Everywhere のセクション プロパティ AllowDefinition に従って、構成ファイルの関連するセクションから情報を読み取ったり、このセクションに情報を書き込んだりできます。 |

既存の Web アプリケーションの構成ファイルから HttpCookiesSection オブジェクトを取得する方法を次のコード例に示します。
' Get the Web application configuration. Dim webConfig _ As System.Configuration.Configuration = _ WebConfigurationManager.OpenWebConfiguration("/aspnetTest") ' Get the section. Dim configPath As String _ = "system.web/httpCookies" Dim httpCookiesSection _ As System.Web.Configuration.HttpCookiesSection = _ CType(webConfig.GetSection(configPath), _ System.Web.Configuration.HttpCookiesSection)
// Get the Web application configuration. System.Configuration.Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("/aspnetTest"); // Get the section. string configPath = "system.web/httpCookies"; System.Web.Configuration.HttpCookiesSection httpCookiesSection = (System.Web.Configuration.HttpCookiesSection)webConfig.GetSection( configPath);

System.Configuration.ConfigurationElement
System.Configuration.ConfigurationSection
System.Web.Configuration.HttpCookiesSection


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- HttpCookiesSection クラスのページへのリンク