VB.NETのHTTPダウンロード例

2011/08/10 15:23Update
TAGS: Response | ダウンロード | attachment | ContentType | Charset | HttpUtility.UrlEncode

VB.NETのHTTPダウンロード例

Response.Charset = "Shift_JIS"                            '文字コードの設定
Response.ContentType = "application/octet-stream"        'コンテンツの種類
Response.AddHeader("Content-Disposition", "attachment; filename=" & HttpUtility.UrlEncode("ファイル名.csv"))        'ダウンロード ファイル名、ファイル名は日本語である場合、HttpUtility.UrlEncodeでエンコードする必要がある

Response.Write("ファイル内容")                            '書き込み内容

Response.Flush()                                        '書き込み途中フラッシュ
Response.End()                                            'レスポンス終了する場合

.

有关作者
Syboos.jp編集長AJavaやオープンソース情報の執筆、Webサイトの開発や運営全般の業務に携わる。

Sponsored Link


Comments

用户名 (required)

Email (will not be published) (required)

URL

Evaluation

  • Relative Articles