
376
|
Chapter 17: The HttpResponse Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
AppendToLog
Response.AppendToLog(ByVal param As String)
Appends the text specified by the param argument to the IIS log file for the current
IIS application.
Parameter
param
A String argument containing the text to be appended to the IIS log.
Example
The following example writes a message to the IIS log for the application the page
is a part of, and then writes a message to the ASP.NET Message label control indi-
cating that the message was written:
Sub Page_Load( )
Response.AppendToLog("Hello from Page_Load!")
Message.Text = "Message written to IIS Log!"
End Sub
The IIS log entry generated by the example above looks similar to the following:
2001-10-14 00:13:14 127.0.0.1 - 127.0.0.1 80 GET
/ASPdotNET_iaN/Chapter_17/AppendToLog.aspx
Hello+from+Page_Load! 200 BrowserString
Notes
Unlike the AppendToLog method in classic ASP, which had a limit of 80 charac-
ters per call, you can write as much text as you wish to the log by using
AppendToLog in ASP.NET. The IIS Log files are located by default in %windir%\
System32\LogFiles\W3SVC
x\exdate.log, where %windir% is the name of the
Windows directory, x is the number of the Web site for the log (this is the IIS
Metabase name for the desired application), and date is the creation date of the
log file.
ApplyAppPathModifier ...