IIS7 – post #13 – Failed Request Tracing (FREB) and my own version of FREB Tree Control (v0.01)

It has been a while since I geeked on IIS7.  I was checking out Mike Volodarsky blog for the latest and greatest on IIS7.   There was an article on FREB (Failed Request Event Buffer).  This feature has been politely renamed to Failed Request Tracing, I have a feeling FREB will stick around.   Mike pointed to an updated FREB.XSL.  This helps display requests in a more friendly format than using Notepad.  Here is the article by Bill Staples about this. Making Failed Request Tracing More Approachable  

I like viewing things in TreeControls so lets start a FREB Tree Control.  🙂  This version displays the FailedReqLogFiles sub-folders with associating files in a TreeView.  You can click on the file and have it display in IE.  This version only works in IE.  Firefox pops up a message about not knowing how to display an XML file.  I'm sure there is a Firefox guru reading this post that knows how to resolve that. 🙂   Here is the code for the tree control.  You can download the code here.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Failed Request Tracing Tree Control</title>
    <form id="form1" runat="server">


Failed Request Tracing Tree Control by Steve Schofield










Imports System.IO

Partial Class _Default
    Inherits System.Web.UI.Page

    Private Const LogRoot = "C:inetpublogsFailedReqLogFiles"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'On the first page visit, populate the photo tree and select the root node
        If Not Page.IsPostBack Then
        End If
    End Sub

    Private Sub PopulateTree()
        'Populate the tree based on the subfolders of the specified LogRoot
        Dim rootFolder As New DirectoryInfo(LogRoot)
        Dim root As TreeNode = AddFoldersToTreeView(rootFolder, Nothing)

        'Add the root to the TreeView
    End Sub

    Private Function AddFoldersToTreeView(ByVal folder As DirectoryInfo, ByVal parentNode As TreeNode) As TreeNode
        'Add the TreeNode, displaying the folder's name and storing the full path to the folder as the value…
        Dim virtualFolderPath As String

        If parentNode Is Nothing Then
            virtualFolderPath = LogRoot
            virtualFolderPath = parentNode.Value & folder.Name & "/"
        End If

        Dim node As New TreeNode(folder.Name, virtualFolderPath)
        Dim subFolders As DirectoryInfo() = folder.GetDirectories()

        For Each subFolder As DirectoryInfo In subFolders
            Dim files As TreeNode = AddFilesToTreeView(subFolder)
        Return node     'Return the new TreeNode
    End Function

    Private Function AddFilesToTreeView(ByVal folder As DirectoryInfo) As TreeNode
        'Add the TreeNode, displaying the folder's name and storing the full path to the folder as the value…
        Dim files As New TreeNode(folder.Name, folder.Name.ToString())
        For Each file As FileInfo In folder.GetFiles()
            Dim child As New System.Web.UI.WebControls.TreeNode
            child.Value = "<a href='" & file.FullName.ToString & "' target='_blank'>" & file.FullName.ToString & "</a>"
        Return files     'Return the new TreeNode
    End Function
End Class

Here is an image of this running on my Longhorn server.


Steve Schofield
Microsoft MVP – IIS


2 thoughts on “IIS7 – post #13 – Failed Request Tracing (FREB) and my own version of FREB Tree Control (v0.01)”

  1. Greetings,
    I encountered an error in my inetpub/logs/FailedReqLogFile/W3SVC1
    (Cannot view XML input using XSL style sheet) access denied
    This is the first time this has occured. I have tried
    to find an answer to the problem online but to no avail. My OS is Windows Vista Ultimate/IIS 7.
    Any help would be greatly appreciated
    Sincerely, Richard M


  2. >>(Cannot view XML input using XSL style sheet) access denied
    You have to configure IE7 to allow this.
    You can get around this by sharing out the directory then viewing the log files from an XP machine (using IE7 is now OK).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: