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.

Default.aspx
————
<%@ 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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>Failed Request Tracing Tree Control by Steve Schofield</h1>
        <table width="100%">
            <tr>
                <td style=’width:25%’ valign=’top’>
                     <asp:TreeView ID="TreeView1" runat="server" ExpandDepth=1>
                    </asp:TreeView>
                   
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

Default.aspx.vb
————

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
            PopulateTree()
        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
        TreeView1.Nodes.Add(root)
    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
        Else
            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)
            node.ChildNodes.Add(files)
        Next
        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>"
            files.ChildNodes.Add(child)
        Next
        Return files     ‘Return the new TreeNode
    End Function
End Class

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

Enjoy,

Steve Schofield
Microsoft MVP – IIS

 

CAPTCHA links

I was looking at using some type of image verification on my website.   Here are some links with information about ‘CAPTCHA’.   Please pass along your tips and tricks when using this technology to stop spam bots, comment spam bots and other automated tools to submit  information to your site.

        Stopping Automated Web Robots Visiting ASP/ASP.NET Websites
        http://tinyurl.com/y8swha

        What is CAPTCHA?
        http://www.captcha.net/

Tx,

Steve

IDS notes

I’ve been toying around with Snort (IDS) for windows.  Here are some major links.   

‘download winpcap
http://www.winpcap.org/install/default.htm

‘snort for windows
http://snort.org/dl/binaries/win32/

‘Textpad to read snort.conf (notepad doesn’t work)
http://www.textpad.com/download/index.html

‘download rules place in c:snortrules
http://snort.org/pub-bin/downloads.cgi
1) register first
2) download / extract (The Official Snort Ruleset (registered user release)
3) download / extract Community Rules 

‘edit snort.conf
change 3 things
#var RULE_PATH ../rules
var RULE_PATH c:Snortrules

# dynamicpreprocessor directory /usr/local/lib/snort_dynamicpreprocessor/
 dynamicpreprocessor directory c:Snortlibsnort_dynamicpreprocessor

# dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so
 dynamicengine c:Snortlibsnort_dynamicenginesf_engine.dll


references
http://thelazyadmin.com/index.php?/archives/121-Running-SNORT-IDS-on-Windows-2003.html

Search engine tips / tricks.

Every heard the question; How do I get my site to come up in the search engines?  This is a real art-form rather than a silver bullet.  Best thing you can do is have people on other sites link to your site.  It doesn’t hurt to submit to http://www.Google.com, http://www.Yahoo.com.  These are free and usually can help generate some traffic.   Additional items is have a robots.txt located in the root of the folder, as many key words as possible in the meta-tag key words.  I’m not sure how effective using keywords in meta-tag headers, it sure can’t hurt. ?

None of these techniques will ensure you top position in Google right away unless you are willing to pay for click option.  This can be rather costly and proceeding with caution is recommended.  A few other options is to have some general based text in the Title of his page because that is usually what shows up in a search result.  There are other *free* services that will submit your site to a lot of the search engines but the main ones like Yahoo, Google, MSN, Alta-Vista are good ones to start with.  If you have a few tricks to pass along, let me know.

The Web Robots Pages
http://www.robotstxt.org/wc/robots.html

Webmaster Help Center
http://www.google.com/support/webmasters/bin/topic.py?topic=8458

Yahoo Help
http://help.yahoo.com/help/us/ysearch/?fr=yfp-t-501

How To Use HTML Meta Tags
http://searchenginewatch.com/showPage.html?page=2167931

Tx,

Steve Schofield
Microsoft MVP – IIS

IIS7 compression info

I just posted a blog about IIS6 compression.  I was wondering if IIS7 compression was much different.  After some searching, here are some links I found regarding IIS7 compression.  I enabled this successfully on my IISLogs.com server and is working great.  A quick search on Technet doesn’t have any IIS7 compression info.

Migrating an ASP.NET app to IIS 7
http://www.west-wind.com/WebLog/posts/6075.aspx

Changes to compression in IIS7
http://blogs.msdn.com/kjsingla/archive/2006/06/13/Changes-to-compression-in-IIS7.aspx

IIS Compression by Bernard Cheah
http://msmvps.com/blogs/bernard/archive/2004/12/01/21614.aspx

Tx,

Steve

IIS6 compression links

Here are a few good links on IIS 6 compression.  

IIS6 compression by Scott Forsyth
http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx

Enabling HTTP Compression
http://technet2.microsoft.com/WindowsServer/en/library/ae342c42-fbc4-4ab7-b9ac-20a89f0fa4ad1033.mspx?mfr=true

Customizing the File Types IIS Compresses
http://technet2.microsoft.com/WindowsServer/en/library/9fbab3d5-6f02-4c2c-a018-21e1f69d986e1033.mspx?mfr=true

Tx,

Steve