次の方法で共有


HttpResponse.ClearHeaders メソッド

バッファ ストリームからすべてのヘッダーを削除します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Sub ClearHeaders
'使用
Dim instance As HttpResponse

instance.ClearHeaders
public void ClearHeaders ()
public:
void ClearHeaders ()
public void ClearHeaders ()
public function ClearHeaders ()
適用できません。

例外

例外の種類 条件

HttpException

HTTP ヘッダーが送信された後にヘッダーが削除されます。

使用例

次のコード例では、ClearHeaders メソッドを呼び出して、現在の応答にヘッダーが送信されないようにします。このテクニックは、ASP.NET 応答が JPEG ファイルなどのイメージを生成する場合に特に重要です。この例では、ContentType プロパティは image/jpeg に設定されます。

' Clear headers to ensure none
' are sent to the requesting browser
' and set the content type.
Response.ClearHeaders()
Response.ContentType = "image/jpeg"
// Clear headers to ensure none
// are sent to the requesting browser
// and set the content type.
Response.ClearHeaders();
Response.ContentType = "image/jpeg";

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

HttpResponse クラス
HttpResponse メンバ
System.Web 名前空間
ClearContent