Showing posts with label iis. Show all posts
Showing posts with label iis. Show all posts

Friday, January 13, 2012

Extract bindings from IIS 6 metabase (the easy way)

Xslt can be very handy, specially when you have a bunch of data in xml format and you want to extract some.
To extract all the bindings froma running iis6 server the easiest way is to:

1) Create the XSL file
Save this XSLT file as metabase.xsl:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:out="urn:microsoft-catalog:XML_Metabase_V64_0">
<xsl:output method="html" />
    <xsl:template match="/">
        <html>
        <body>
            <table border="1">
            <xsl:for-each select="//out:IIsWebServer">
                <tr>
                <td><xsl:value-of select="@ServerComment" /></td>
                <td><xsl:value-of select="@ServerBindings" /></td>
                </tr>
            </xsl:for-each>
            </table>
        </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
2) Tell metabase to use the XSL
Copy the metabase in a safe place (do not edit it in place) in the same folder where you saved metabase.xsl
Metabase usually sits on folder: C:\Windows\System32\Inetsrv
Edit the second line and add this:
<?xml-stylesheet type="text/xsl" href="metabase.xsl"?>

3) Open metabase.xml with you browser
Opening metabase now will show you all bindings in a nice table.


You may copy/paste in excel if you like.

Submit this story to DotNetKicks

Wednesday, December 21, 2011

Preventing your site from being indexed, the right way

The robots exclusion protocol (REP), or robots.txt is a text file webmasters create to instruct robots (typically search engine robots) on how to crawl & index pages on their website.
Some people use robots.txt files to prevent sites from being indexed and thus showing up in the search engines.
But robots.txt doesn't actually do the latter, even though it does prevent your site from being indexed.
So, if you want to effectively hide pages from the search engines, and this might seem contradictory, you need them to index those pages. Why? Because when they index those pages, you can tell them not to List them. There's two ways of doing that:

Using meta tag on every page
By using robots meta tags, like this:
<meta name="robots" content="noindex,nofollow"/>

The issue with a tag like that is that you have to add it to each and every page. That's why the search engines came up with the X-Robots-Tag HTTP header.

Setting up for a whole site using IIS
If your site is running on IIS you can do by adding a custom HTTP Header
IIS 6: right-click on the "Web Sites" folder > Properties > HTTP Headers
IIS 7: on the server home screen, click on HTTP Request Headers, choose "add"
Name: X-Robots-Tag
Value: noindex, nofollow
And it'd have the effect that that entire site can be indexed, but will never be shown in the search results.
So, get rid of that robots.txt file with Disallow: / in it, and use the X-Robots-Tag instead!

Submit this story to DotNetKicks