トップページに戻る
次のC#のサンプルへ
前のC#のサンプルへ
4-1 アクセスログ
C#のサンプル
ソース(VB2005)
Option Strict On : Option Explicit On
Partial Public Class _Default : Inherits Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim OutFilePath As String = Request.PhysicalApplicationPath & "AccessLog.txt"
Dim WillOut As String = ""
WillOut &= DateTime.Now.ToString & Environment.NewLine
WillOut &= Request.UserHostName & Environment.NewLine
WillOut &= Request.UserAgent & Environment.NewLine
WillOut &= Request.Url.ToString & Environment.NewLine
IO.File.AppendAllText(OutFilePath, WillOut, Text.Encoding.GetEncoding("Shift-Jis"))
Response.Write("<pre>")
Response.Write(WillOut)
Response.Write("</pre>")
End Sub
End Class
実行結果
作成中
解説