My Developer Memo
開発に関する覚え書き
Latest Entries
Recent Comments
Search this site
Categories
Archives
Links
Syndicate this site
RSS1.0
Atom0.3
Powered by
Serene Bach 2.23R
<< [MSUPD] 2007-12 更新情報
|
main
|
HTTP拡張モジュールでログ出力 >>
2007/12/12 (水)
●
ノータッチデプロイメントのパラメータ付き起動
HTTPHandler拡張コードサンプル
Imports System.Web Namespace MySelf.Framework.IHTTPImple Public Class ConfigFileHandler Implements IHttpHandler ''' ----------------------------------------------------------------------------- '''
''' 別要求で、IHTTPHandler を使用出来るかどうか '''
'''
論理値
'''
'''
''' ----------------------------------------------------------------------------- Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable Get Return True End Get End Property ''' ----------------------------------------------------------------------------- '''
''' カスタムHttpHandler処理 '''
'''
'''
''' ノータッチデプロイメントPG要求において、パラメータが付加されたパスが指定された場合 ''' 「App名.exe?param1=val1…」というアプリが要求されると『App名.exe?param1=val1….config』という ''' 構成ファイルがダウンロード要求されるが、このファイルは実際には存在しない。 ''' 上記のようなパラメータ付き実行ファイルが要求されても『App名.exe.config』構成ファイルを ''' ダウンロードするようにする。 '''
''' ----------------------------------------------------------------------------- Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest Dim path As String = context.Request.PhysicalPath Dim url As String = context.Request.RawUrl Dim ext As String = ".config" ' If url.ToLower().EndsWith(ext) Then context.Response.WriteFile(path + ext) Else context.Response.ContentType = "application/octet-stream" context.Response.WriteFile(path) End If End Sub End Class End Namespace