中文版 | English

网站首页 | 个人作品 | 站长日志 | 给我留言 | 经典分享 | 友情链接 | 黑白人生


用asp查看登陆本IIS服务器的记录

这个东西是看iis帮助看的,昨天晚上还看到好多好东西,不过微软的人关键东西都带过不说.而且有个超级强悍的功能居然是在苹果机(他们开发iis的环境)下才可以用,我日了太浪费!
<%
LogFile = Request.Form("logfile")
StartDate = Request.Form("startdt")
EndDate = Request.Form("enddt")
%><H3>Display a Range of Log Records by Date</H3><FORM NAME="getlogfilename" METHOD="POST" ACTION="Log_ReadFilter.asp">
Please enter the full path name of a log file to read in %SystemRoot%\system32\LogFiles\*SVC*\*.log:<BR>
<input type="TEXT" NAME="logfile" size=70 value=<%=LogFile%>><BR><BR>
Start DateTime:
<input type="TEXT" NAME="startdt" value=<%=StartDate%>> (Optional)<BR>
End DateTime:
<input type="TEXT" NAME="enddt" value=<%=EndDate%>> (Optional)<BR>
(Use the format 'MM/DD/YYYY HH:MM:SS AM/PM')<BR><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM><%
''''''''''''''''''''
' Log file formats:
' "NCSA Common Log File Format"
' "Microsoft IIS Log File Format"
' "W3C Extended Log File Format"
'''''''''''''''''''''Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")If (fsoObject.FileExists(LogFile)) ThenSet oRead = CreateObject ("MSWC.IISLog")
oRead.OpenLogFile LogFile, 1, "W3SVC", 1, "W3C Extended Log File Format"If Not (StartDate = "" Or EndDate = "") Then
    oRead.ReadFilter StartDate,EndDate
End IfoRead.ReadLogRecord
%>
<TABLE Border=1>
<TR><TD>
<B>Date/Time</TD><TD><B>Client IP</TD><TD><B>User Name</TD><TD><B>URL Requested
</B></TD></TR>
<%
Do While Not oRead.AtEndOfLog
    Response.Write "<TR><TD>&nbsp;" & oRead.DateTime & "</TD>"
    Response.Write "<TD>&nbsp;" & oRead.ClientIP & "</TD>"
    Response.Write "<TD>&nbsp;" & oRead.UserName & "</TD>"
    Response.Write "<TD>&nbsp;" & oRead.URIStem & "</TD></TR>"
    oRead.ReadLogRecord
Loop
%>
</TABLE>
<%
oRead.CloseLogFiles 1ElseIf Not (LogFile = "") ThenResponse.Write "ERROR: " & LogFile & " does not exist."End If%>



Copyright 1998-2021. All rights reserved.
工信部备案:冀ICP备19032940号-1|公安部备案号:13020802000209