<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>WEBDUDE</title>
        <link>http://www.webdude.co.za/Default.aspx</link>
        <description>while(Page.Load) {Web.Optimize();}</description>
        <language>en-ZA</language>
        <copyright>WebDude</copyright>
        <generator>Subtext Version 2.1.2.2</generator>
        <image>
            <title>WEBDUDE</title>
            <url>http://www.webdude.co.za/images/RSS2Image.gif</url>
            <link>http://www.webdude.co.za/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Custom Errors in IIS7</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2009/09/07/custom-errors-in-iis7.aspx</link>
            <description>&lt;p&gt;Having recently moved over to IIS7, one of my stumbling blocks has been around custom errors. &lt;br /&gt;
This works really well in IIS6, but as soon as you move over to IIS7 seems to completely stop working in most cases.&lt;/p&gt;
&lt;p&gt;Requests to folders or files without .aspx extensions seems to just throw a Server Error&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.webdude.co.za/images/www_webdude_co_za/WindowsLiveWriter/CustomErrorsinIIS7_B6DA/ServerError_2.jpg"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="ServerError" border="0" alt="ServerError" width="941" height="169" src="http://www.webdude.co.za/images/www_webdude_co_za/WindowsLiveWriter/CustomErrorsinIIS7_B6DA/ServerError_thumb.jpg" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This was less than ideal, so I set out to find out the right way to do this in IIS7.&lt;/p&gt;
&lt;p&gt;You may be familiar with a section in your web configuration file named :&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id="codeSnippet"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;system.webServer&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In IIS6 this section is totally ignored, but the minute you move to IIS7 this section becomes oh so important. &lt;br /&gt;
We generally setup our modules and handlers here, but there is another section we can add called:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id="codeSnippet"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;httpErrors&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now this can also be controlled through the IIS7 interface, but here I'll show you how to do this in code. &lt;br /&gt;
&lt;br /&gt;
Firstly, this element is locked at application server level. &lt;br /&gt;
This means you will not be able to modify it in your web configuration file unless you allow this in your application host configuration file. &lt;br /&gt;
If you’re unfamiliar with this file, you can think of it as IIS’s Application Configuration file.&lt;/p&gt;
&lt;p&gt;Before you do this, please note:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;It is highly dangerous to mess with this file and can take down every website on your entire web server. Please approach with caution! &lt;br /&gt;
Please back this file up before trying anything&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now that we have that out the way, you can find this file in the following location:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;c:\Windows\System32\inetsrv\config\applicationHost.config&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;in this file navigate to a line that reads&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id="codeSnippet"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;section&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;name&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="httpErrors"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;overrideModeDefault&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Allow"&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And alter the overrideModeDefault to be Allow&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id="codeSnippet"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;section&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;name&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="httpErrors"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;overrideModeDefault&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Allow"&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Save this file, and you are now free to add HttpErrors to your web configuration file. &lt;br /&gt;
So, inside the system.webServer section add the following code&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" id="codeSnippet"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;httpErrors&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;errorMode&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Custom"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;existingResponse&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Replace"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;defaultPath&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="/500/Default.aspx"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;defaultResponseMode&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="ExecuteURL"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;  &lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;clear&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;  &lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;error&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;statusCode&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="404"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;path&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="/404/default.aspx"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;prefixLanguageFilePath&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;=""&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;responseMode&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="ExecuteURL"&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: &amp;quot;Courier New&amp;quot;, courier, monospace; DIRECTION: ltr; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;httpErrors&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now this is pretty much the magic that makes your 404’s (and 500’s) work properly. &lt;br /&gt;
You may now remove or comment out your existing customErrors section. &lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px" class="wlWriterHeaderFooter"&gt;&lt;a rev="vote-for" href="http://dotnetburner.com/vote?url=http%3a%2f%2fwww.webdude.co.za%2farchive%2f2009%2f09%2f07%2fcustom-errors-in-iis7.aspx"&gt;&lt;img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" alt="Burn!" src="http://dotnetburner.com/image.axd?url=http%3a%2f%2fwww.webdude.co.za%2farchive%2f2009%2f09%2f07%2fcustom-errors-in-iis7.aspx" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.webdude.co.za/aggbug/19.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2009/09/07/custom-errors-in-iis7.aspx</guid>
            <pubDate>Mon, 07 Sep 2009 06:21:32 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2009/09/07/custom-errors-in-iis7.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/19.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Disable button on post back &amp;ndash; working with validators</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2009/01/26/disable-button-on-post-back-ndash-working-with-validators.aspx</link>
            <description>&lt;p&gt;In the past I’ve written a post on how to disable a button on post back:&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://www.webdude.co.za/archive/2008/09/02/disable-button-on-post-back.aspx"&gt;Disable button on past back&lt;/a&gt;&lt;/p&gt;
&lt;div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BACKGROUND-COLOR: #f4f4f4"&gt;
&lt;div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   1:&lt;/span&gt; &amp;lt;script language=&lt;span style="COLOR: #006080"&gt;"javascript"&lt;/span&gt; type=&lt;span style="COLOR: #006080"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   2:&lt;/span&gt; &amp;lt;!--&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   3:&lt;/span&gt;    &lt;span style="COLOR: #0000ff"&gt;function&lt;/span&gt; disableAndPost()&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   4:&lt;/span&gt;    {&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   5:&lt;/span&gt;       &amp;lt;%= ClientScript.GetPostBackEventReference(btnDoSomething, &lt;span style="COLOR: #006080"&gt;""&lt;/span&gt;) %&amp;gt;;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   6:&lt;/span&gt;       document.getElementById(&lt;span style="COLOR: #006080"&gt;'&amp;lt;%=btnDoSomething.ClientID %&amp;gt;'&lt;/span&gt;).disabled=&lt;span style="COLOR: #006080"&gt;"disabled"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   7:&lt;/span&gt;    }&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   8:&lt;/span&gt; --&amp;gt;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   9:&lt;/span&gt; &amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
This works really nicely, until you try use this with ASP.NET Validators. &lt;br /&gt;
&lt;br /&gt;
Fortunately, there is a simple work around for this. &lt;br /&gt;
We need to check is the javascription function Page_ClientValidate() is true or false.&lt;/p&gt;
&lt;p&gt;This can be achieved easily by modifying the above code as follows:&lt;/p&gt;
&lt;div style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; CURSOR: text; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BACKGROUND-COLOR: #f4f4f4"&gt;
&lt;div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   1:&lt;/span&gt; &amp;lt;script language=&lt;span style="COLOR: #006080"&gt;"javascript"&lt;/span&gt; type=&lt;span style="COLOR: #006080"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   2:&lt;/span&gt; &amp;lt;!--&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   3:&lt;/span&gt;    &lt;span style="COLOR: #0000ff"&gt;function&lt;/span&gt; disableAndPost()&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   4:&lt;/span&gt;    {&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   5:&lt;/span&gt;       &lt;span style="COLOR: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="COLOR: #0000ff"&gt;typeof&lt;/span&gt;(Page_ClientValidate) == &lt;span style="COLOR: #006080"&gt;'function'&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="COLOR: #0000ff"&gt;if&lt;/span&gt; (Page_ClientValidate() == &lt;span style="COLOR: #0000ff"&gt;false&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   7:&lt;/span&gt;            &lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;false&lt;/span&gt;; &lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   8:&lt;/span&gt;       &amp;lt;%= ClientScript.GetPostBackEventReference(btnDoSomething, &lt;span style="COLOR: #006080"&gt;""&lt;/span&gt;) %&amp;gt;;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;   9:&lt;/span&gt;       document.getElementById(&lt;span style="COLOR: #006080"&gt;'&amp;lt;%=btnDoSomething.ClientID %&amp;gt;'&lt;/span&gt;).disabled=&lt;span style="COLOR: #006080"&gt;"disabled"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;  10:&lt;/span&gt;    }&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;  11:&lt;/span&gt; --&amp;gt;&lt;/pre&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #606060"&gt;  12:&lt;/span&gt; &amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This will exit out of the function if the form is not yet validated. &lt;br /&gt;
Simple as that!&lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/13.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2009/01/26/disable-button-on-post-back-ndash-working-with-validators.aspx</guid>
            <pubDate>Mon, 26 Jan 2009 11:05:12 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2009/01/26/disable-button-on-post-back-ndash-working-with-validators.aspx#feedback</comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/13.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ASP.NET Website working within a frame</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2009/01/21/asp.net-website-working-within-a-frame.aspx</link>
            <description>&lt;p&gt;I recently was tasked with creating an ASP.NET Website that will run within a Frame on another domain.&lt;/p&gt;
&lt;p&gt;Not realising the inherent problem with this method, I set about happily creating a website as I normally do oblivious to the impending problems about to be uncovered. &lt;br /&gt;
In development my website worked as expected, passed QA testing and was on it’s way up to production where it would finally be placed inside it’s frame for use.&lt;/p&gt;
&lt;p&gt;So imagine the “Shock and Awe” when the application didn’t work what so ever. Like it couldn’t maintain a session.&lt;/p&gt;
&lt;p&gt;So it turns out depending on Browser security settings, 3rd party cookies are disabled and websites within frames can not rely on cookies and can therefore not utilise session cookies. &lt;br /&gt;
Luckily however there is a simple solution for this.&lt;/p&gt;
&lt;p&gt;All we need to do is add a p3p – Privacy Preferences Project - header which will indicate to the browser that this is in fact a site that can be trusted. &lt;br /&gt;
In essence this published a privacy policy which states what kind of information is collected and whether it will be used for forces of true evil or not. &lt;br /&gt;
Personally I don’t quite get it, because anyone intending on abusing this system can do just the same to get their pirate hacking sites to work.&lt;/p&gt;
&lt;p&gt;But that’s not me, I behave, so I’m happy there’s a solution! &lt;br /&gt;
Well, enough pre-amble … let’s code!!&lt;/p&gt;
&lt;p&gt;This is the header you have to:&lt;/p&gt;
&lt;div style="FONT-FAMILY: courier new; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;
&lt;p style="MARGIN: 0px"&gt;HttpContext.Current.Response.AddHeader(&lt;span style="COLOR: #a31515"&gt;"p3p"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""&lt;/span&gt;);&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;I utilise this by placing it into an HttpModule like follows:&lt;/p&gt;
&lt;div style="FONT-FAMILY: courier new; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    1&lt;/span&gt; &lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; WebDude&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    2&lt;/span&gt; {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    3&lt;/span&gt;     &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PrivacyPreferencesHeader&lt;/span&gt; : IHttpModule&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    4&lt;/span&gt;     {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    5&lt;/span&gt;         &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Init(HttpApplication context)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    6&lt;/span&gt;         {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    7&lt;/span&gt;             context.BeginRequest += context_BeginRequest;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    8&lt;/span&gt;         }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;    9&lt;/span&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   10&lt;/span&gt;         &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; context_BeginRequest(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   11&lt;/span&gt;         {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   12&lt;/span&gt;             HttpContext.Current.Response.AddHeader(&lt;span style="COLOR: #a31515"&gt;"p3p"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   13&lt;/span&gt;         }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   14&lt;/span&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   15&lt;/span&gt;         &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Dispose()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   16&lt;/span&gt;         {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   17&lt;/span&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   18&lt;/span&gt;         }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   19&lt;/span&gt;     }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   20&lt;/span&gt; }&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Reference this HttpModule in your Web.Config’s HttpModule section&lt;/p&gt;
&lt;div style="FONT-FAMILY: courier new; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;PrivacyPreferencesHeader&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WebDude.PrivacyPreferencesHeader, WebDude&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can download the csharp source file &lt;a href="http://www.webdude.co.za/code/p3p/PrivacyPreferencesHeader.zip"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Googling on the web, I found the same solution for some other languages thanks to &lt;a target="_blank" href="http://viralpatel.net/blogs/2008/12/how-to-set-third-party-cookies-with-iframe.html"&gt;this post&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP&lt;/strong&gt; &lt;br /&gt;
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;JSP&lt;/strong&gt; &lt;br /&gt;
response.setHeader("P3P","CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'")&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Coldfusion&lt;/strong&gt; &lt;br /&gt;
&amp;lt;cfheader name="P3P" value="CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'" /&amp;gt;&lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/12.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2009/01/21/asp.net-website-working-within-a-frame.aspx</guid>
            <pubDate>Wed, 21 Jan 2009 05:43:10 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2009/01/21/asp.net-website-working-within-a-frame.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/12.aspx</wfw:commentRss>
        </item>
        <item>
            <title>GamerLobby syndicatable frame</title>
            <category>General</category>
            <link>http://www.webdude.co.za/archive/2008/11/25/gamerlobby-syndicatable-frame.aspx</link>
            <description>So we had a little experiment on the GamerLobby to create a frame displaying our matches that could be easily integrated into community sites out there. This is what it looks like: &lt;iframe src="http://gamerlobby.net/xbox/matches/frame/viewall/default.aspx" frameborder="0" width="480" height="380" allowtransparency="allowtransparency" /&gt;&lt;img src="http://www.webdude.co.za/aggbug/11.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/11/25/gamerlobby-syndicatable-frame.aspx</guid>
            <pubDate>Tue, 25 Nov 2008 15:16:56 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/11/25/gamerlobby-syndicatable-frame.aspx#feedback</comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/11.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Creating your own Unhandled Error Logging Module</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2008/09/17/creating-your-own-unhandled-error-logging-module.aspx</link>
            <description>&lt;p&gt;I'm a big fan of the &lt;a target="_blank" href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt; project which I utilise in my personal website &lt;a target="_blank" href="http://www.gamerlobby.net"&gt;GamerLobby.net&lt;/a&gt;&lt;br /&gt;
This is great for plugging into an existing website to catch unhandled exceptions, but not ideal when you want to log to an existing infrastructure.&lt;br /&gt;
So I set of on the task to create my own custom unhandled error logging module, and this is what I came up with.&lt;/p&gt;
&lt;p&gt;HttpApplication contains various information that can be really useful when finding bugs or reviewing errors.&lt;br /&gt;
This can be nicely broken down into 5 categories:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Exception Information &lt;/li&gt;
    &lt;li&gt;Server Variables &lt;/li&gt;
    &lt;li&gt;QueryString Variables &lt;/li&gt;
    &lt;li&gt;Form Variables &lt;/li&gt;
    &lt;li&gt;Cookie Variables &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Exception Information&lt;/strong&gt;&lt;br /&gt;
This is available using the &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;.Server.GetLastError() method.&lt;br /&gt;
This returns a System.&lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Server Variables&lt;/strong&gt;&lt;br /&gt;
This contains a stacks of useful information. This includes info like: HTTP_REFERER, HTTP_USER_AGENT, PATH_INFO, REMOTE_ADDR and several other useful items to help trace the cause of the exception.&lt;br /&gt;
This is obtained from the &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;.Context.Request.ServerVariables NameValue collection.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;QueryString Variables&lt;/strong&gt;&lt;br /&gt;
This will contain your querystring information.&lt;br /&gt;
This is obtained from the &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;.Context.Request.QueryString NameValue collection.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Form Variables&lt;/strong&gt;&lt;br /&gt;
This will contain any form information like that posted to the page that threw the exception.&lt;br /&gt;
This is obtained from the &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;.Context.Request.Forms NameValue collection.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Cookie Variables&lt;/strong&gt;&lt;br /&gt;
This will read any cookie information stored by your website.&lt;br /&gt;
This is obtained from the &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;.Context.Request.Cookies HttpCookieCollection.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Now we can create a module to catch an unhandled exception, and gather all this information.&lt;br /&gt;
We start by creating a class that inherits from the interface &lt;span style="COLOR: #2b91af"&gt;IHttpModule&lt;/span&gt;.&lt;br /&gt;
In our Init method, we assign a delegate to our Error event of our &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt; context. &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;span style="COLOR: blue"&gt;public class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ErrorHandler&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;IHttpModule&lt;/span&gt;&lt;br /&gt;
{&lt;br /&gt;
   &lt;span style="COLOR: blue"&gt;public void&lt;/span&gt; Init(&lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt; context)&lt;br /&gt;
   {&lt;br /&gt;
      context.Error += Context_Error;&lt;br /&gt;
   }&lt;br /&gt;
} &lt;/blockquote&gt;
&lt;p&gt;Simple as that, any unhandled exception that occurs in our application, will be caught by our Context_Error event. Lovely!&lt;br /&gt;
Now let's setup our Context_Error void. Here we can gather all our information we need, and use it as we see fit&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;span style="COLOR: blue"&gt;public void&lt;/span&gt; Context_Error(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;br /&gt;
{&lt;br /&gt;
   &lt;span style="COLOR: green"&gt;//Cast sender to a HttpApplication&lt;/span&gt;&lt;br /&gt;
   &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt; app = (HttpApplication)sender;&lt;br /&gt;
&lt;br /&gt;
   &lt;span style="COLOR: green"&gt;//Get the exception that occurred&lt;/span&gt;&lt;br /&gt;
   &lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt; ex = app.Server.GetLastError();&lt;br /&gt;
&lt;br /&gt;
   &lt;span style="COLOR: green"&gt;//Get Querystring Variables&lt;/span&gt;&lt;br /&gt;
   &lt;span style="COLOR: #2b91af"&gt;NameValueCollection&lt;/span&gt; queryStringVariables = app.Context.Request.QueryString;&lt;br /&gt;
&lt;br /&gt;
   &lt;span style="COLOR: green"&gt;//Get Form Variables&lt;/span&gt;&lt;br /&gt;
   &lt;span style="COLOR: #2b91af"&gt;NameValueCollection&lt;/span&gt; formVariables = app.Context.Request.Form;&lt;br /&gt;
&lt;br /&gt;
   &lt;span style="COLOR: green"&gt;//Get Cookie Collection&lt;/span&gt;&lt;br /&gt;
   &lt;span style="COLOR: #2b91af"&gt;HttpCookieCollection&lt;/span&gt; cookieCollection = app.Context.Request.Cookies;&lt;br /&gt;
&lt;br /&gt;
   &lt;span style="COLOR: green"&gt;//Get Server Variables&lt;/span&gt;&lt;br /&gt;
   &lt;span style="COLOR: #2b91af"&gt;NameValueCollection&lt;/span&gt; serverVariables = app.Context.Request.ServerVariables;&lt;br /&gt;
&lt;br /&gt;
} &lt;/blockquote&gt;
&lt;p&gt;Now you can use this information to log away anything you need to help you troubleshoot the problem.&lt;br /&gt;
2 more methods which may help you loop through a &lt;span style="COLOR: #2b91af"&gt;NameValueCollection&lt;/span&gt; or a &lt;span style="COLOR: #2b91af"&gt;HttpCookieCollection&lt;/span&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;span style="COLOR: green"&gt;//Loop through a name value collection&lt;/span&gt;&lt;br /&gt;
&lt;span style="COLOR: blue"&gt;private static void&lt;/span&gt; AddNameValueCollection(&lt;span style="COLOR: #2b91af"&gt;NameValueCollection &lt;/span&gt;nvc)&lt;br /&gt;
{&lt;br /&gt;
   if (nvc == null || nvc.Count == 0) return;&lt;br /&gt;
   if (nvc.HasKeys())&lt;br /&gt;
   foreach (string key in nvc.Keys)&lt;br /&gt;
   {&lt;br /&gt;
      &lt;span style="COLOR: green"&gt;//Get all your name values with 'key' and 'nvc[key]'&lt;/span&gt;&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style="COLOR: green"&gt;//Loop through an HttpCookieCollection&lt;/span&gt;&lt;br /&gt;
&lt;span style="COLOR: blue"&gt;private static&lt;/span&gt; void AddCookieCollection(&lt;span style="COLOR: #2b91af"&gt;HttpCookieCollection&lt;/span&gt; cookies)&lt;br /&gt;
{&lt;br /&gt;
   if (cookies == null || cookies.Count == 0) return;&lt;br /&gt;
   for (var i = 0; i &amp;lt; cookies.Count; i++)&lt;br /&gt;
   {&lt;br /&gt;
      &lt;span style="COLOR: #2b91af"&gt;var&lt;/span&gt; cookie = cookies[i];&lt;br /&gt;
      &lt;span style="COLOR: green"&gt;//Get all your name values with 'cookie.Name' &amp;amp; 'cookie.Value'&lt;/span&gt;&lt;br /&gt;
   }&lt;br /&gt;
} &lt;/blockquote&gt;
&lt;p&gt;Now you have bucket loads of information to look through in the event of an unhandled exception occurring in your website or web application!&lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/10.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/09/17/creating-your-own-unhandled-error-logging-module.aspx</guid>
            <pubDate>Wed, 17 Sep 2008 14:12:13 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/09/17/creating-your-own-unhandled-error-logging-module.aspx#feedback</comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/10.aspx</wfw:commentRss>
        </item>
        <item>
            <title>HttpModules - Why using HttpApplication is a bad idea</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2008/09/08/httpmodules-why-using-httpapplication-is-a-bad-idea.aspx</link>
            <description>&lt;p&gt;I was using &lt;a target="_blank" href="http://www.darkside.co.za"&gt;Darksider's&lt;/a&gt; &lt;a target="_blank" href="http://darkside.co.za/archive/2008/03/03/web-page-optmisation-using-httpmodule.aspx"&gt;page optimisation module&lt;/a&gt; to clean up and optimise my sites HTML &lt;a target="_blank" href="http://www.gamerlobby.net"&gt;gamerlobby.net&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This was working like an absolute champ up until the night I decided to go live. Leaving &lt;a target="_blank" href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt; for the last minute as it was so darn easy to implement, I started to struggle to get it to start logging.&lt;br /&gt;
It made no sense. Database created, Connection String present and correct, modules and handlers referenced. WHAT CAN IT BE.&lt;/p&gt;
&lt;p&gt;So after hours of scratching my head and freaking out, I commented out &lt;a target="_blank" href="http://www.darkside.co.za"&gt;Darksider's&lt;/a&gt; &lt;a target="_blank" href="http://darkside.co.za/archive/2008/03/03/web-page-optmisation-using-httpmodule.aspx"&gt;page optimisation module&lt;/a&gt; and voila ... Logging works again.&lt;/p&gt;
&lt;p&gt;Very saddened by the fact my pages are no longer optimised, I was determined to work this one out. So finally today, I found the bug.&lt;br /&gt;
The page optimisation was utilising a using statement around the HttpApplication context. This in turn was swallowing the Context and breaking any other modules that attached themselves to HttpApplication events.&lt;/p&gt;
&lt;p&gt;So we changed this: &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; app = sender &lt;span style="COLOR: blue"&gt;as&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;)&lt;br /&gt;
{&lt;br /&gt;
   &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (app.Context.CurrentHandler &lt;span style="COLOR: blue"&gt;is&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Page&lt;/span&gt;)&lt;br /&gt;
   {&lt;br /&gt;
     app.Response.Filter = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PageCleanFilter&lt;/span&gt;(app.Response.Filter);&lt;br /&gt;
   }&lt;br /&gt;
} &lt;/p&gt;
&lt;/blockquote&gt;To this: &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; app = sender &lt;span style="COLOR: blue"&gt;as&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HttpApplication&lt;/span&gt;;&lt;br /&gt;
&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (app.Context.CurrentHandler &lt;span style="COLOR: blue"&gt;is&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Page&lt;/span&gt;)&lt;br /&gt;
{&lt;br /&gt;
  app.Response.Filter = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PageCleanFilter&lt;/span&gt;(app.Response.Filter);&lt;br /&gt;
} &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Now all is logging again, and my page optimised!!&lt;br /&gt;
I'll be sure to pass this onto &lt;a target="_blank" href="http://www.darkside.co.za"&gt;Darksider&lt;/a&gt; to update his post.&lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/9.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/09/08/httpmodules-why-using-httpapplication-is-a-bad-idea.aspx</guid>
            <pubDate>Mon, 08 Sep 2008 11:10:35 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/09/08/httpmodules-why-using-httpapplication-is-a-bad-idea.aspx#feedback</comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/9.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Organising that jungle of cables you're hoarding</title>
            <category>General</category>
            <link>http://www.webdude.co.za/archive/2008/09/03/organising-that-jungle-of-cables-youre-hoarding.aspx</link>
            <description>&lt;p&gt;Several times I've seen these shows on TV about hoarders.&lt;br /&gt;
That seem like really sad people who don't know when to get rid of something, and I pity them.&lt;/p&gt;
&lt;p&gt;So recently I moved house, and to my shocking surprise realised that I was in fact a hoarder to some extent.&lt;br /&gt;
Darn it!! I am one of those people. Well, I guess we are all to some extent. This brings me to the post.&lt;/p&gt;
&lt;p&gt;So after unpacking one of my cupboards, I found tons and tons of cables that I just didn't want to get rid of.&lt;br /&gt;
Stuff that after thinking about it, was utterly useful. A huge mesh of telephone cable, RCA cables, aerial cables, power cables, old cell phone chargers, Vga cables and various others.&lt;br /&gt;
All these cables come in useful from time to time, and lot's don't. On top of this, when you do need a cable it's so darn difficult to get it out of the mesh, it's almost easier to run to the store and buy a new one. So determined to not throw away all my cable, I tried to create a way to organise the cables I needed, and here's what I came up with&lt;/p&gt;
&lt;p&gt;I organised my cables/stuff into 4 categories:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;AV Cables&lt;/strong&gt;
    &lt;ul&gt;
        &lt;li&gt;RCA's &lt;/li&gt;
        &lt;li&gt;VGA &lt;/li&gt;
        &lt;li&gt;Mini Jack to RCA &lt;/li&gt;
        &lt;li&gt;TV Aerials &lt;/li&gt;
        &lt;li&gt;S-Video &lt;/li&gt;
        &lt;li&gt;Etc... &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Data Cables&lt;/strong&gt;
    &lt;ul&gt;
        &lt;li&gt;IPod Data cables &lt;/li&gt;
        &lt;li&gt;Hard Drive Data cables &lt;/li&gt;
        &lt;li&gt;Fire Wire &lt;/li&gt;
        &lt;li&gt;Phone/Camera Data cables &lt;/li&gt;
        &lt;li&gt;Etc... &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Power Cables&lt;/strong&gt;
    &lt;ul&gt;
        &lt;li&gt;Figure 8 cables &lt;/li&gt;
        &lt;li&gt;Kettle plug cables &lt;/li&gt;
        &lt;li&gt;Strange looking 3 hole cables &lt;/li&gt;
        &lt;li&gt;AC Adapters &lt;/li&gt;
        &lt;li&gt;Etc... &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Old Cell Phone Stuff&lt;/strong&gt; (&lt;em&gt;needs refinement&lt;/em&gt; :))
    &lt;ul&gt;
        &lt;li&gt;Old Cell Phones &lt;/li&gt;
        &lt;li&gt;Old Cell Phone charges &lt;/li&gt;
        &lt;li&gt;Old Cell Phone data cables &lt;/li&gt;
        &lt;li&gt;Old Cell Phone memory sticks &lt;/li&gt;
        &lt;li&gt;Etc... &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ok, now I feel like I'm getting somewhere!&lt;br /&gt;
So I separated all my cables as above, wrapped them neatly and cabled tied them.&lt;br /&gt;
I went on to place them into separate clearly labeled packets, and put all the packets into a box in my garage.&lt;/p&gt;
&lt;p&gt;Now I have a system of no mess, I can find cables easily when I need them and most important of all ... My wife is not leaving me :)&lt;/p&gt;
&lt;p&gt;I'd love to hear other people's suggestions or solutions to this problem&lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/8.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/09/03/organising-that-jungle-of-cables-youre-hoarding.aspx</guid>
            <pubDate>Wed, 03 Sep 2008 07:20:24 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/09/03/organising-that-jungle-of-cables-youre-hoarding.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/8.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ServerVariables empty unless Debug</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2008/09/03/servervariables-empty-unless-debug.aspx</link>
            <description>&lt;p&gt;Just had a really strange issue where I'm trying to log some ServerVariables when an error occurs.&lt;/p&gt;
&lt;p&gt;The bug was when I ran the code without debugging, no ServerVariables were being logged.&lt;br /&gt;
If I went into Debug, and hovered my mouse over the ServerVariables variable, it had all the information I was looking for.&lt;br /&gt;
After that, it logged everything fine.&lt;/p&gt;
&lt;p&gt;It seems called a Get on the ServerVariables variable was causing it to initialize properly.&lt;/p&gt;
&lt;p&gt;After some further investigation, I found out I was relying on the NameValueCollection.HasKeys() method to see if I had any value.&lt;br /&gt;
This returns false. Just by calling Request.ServerVariables.Count, this completely fixes the problem.&lt;/p&gt;
&lt;p&gt;So I changed the code as follows, and everything worked as expected&lt;/p&gt;
&lt;p&gt;Changed From:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;font color="#2b91af"&gt;NameValueCollection&lt;/font&gt; nvc = Request.ServerVariables;&lt;br /&gt;
&lt;br /&gt;
if(nvc == &lt;font color="#0000ff"&gt;null&lt;/font&gt;) &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;
&lt;font color="#0000ff"&gt;if&lt;/font&gt; (nvc.HasKeys())&lt;br /&gt;
{&lt;br /&gt;
  &lt;font color="#008000"&gt;//Get ServerVariables Information&lt;/font&gt;&lt;br /&gt;
} &lt;/blockquote&gt;
&lt;p&gt;Changed To:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;font color="#2b91af"&gt;NameValueCollection&lt;/font&gt; nvc = Request.ServerVariables;&lt;br /&gt;
&lt;br /&gt;
if(nvc == &lt;font color="#0000ff"&gt;null&lt;/font&gt; || nvc.Count == 0) &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;
&lt;font color="#0000ff"&gt;if&lt;/font&gt; (nvc.HasKeys())&lt;br /&gt;
{&lt;br /&gt;
  &lt;font color="#008000"&gt;//Get ServerVariables Informatione&lt;/font&gt;&lt;br /&gt;
} &lt;/blockquote&gt;&lt;img src="http://www.webdude.co.za/aggbug/7.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/09/03/servervariables-empty-unless-debug.aspx</guid>
            <pubDate>Wed, 03 Sep 2008 05:46:39 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/09/03/servervariables-empty-unless-debug.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/7.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Disable button on post back</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2008/09/02/disable-button-on-post-back.aspx</link>
            <description>&lt;p&gt;Often post backs can take some time, and it appears to a user as if the browser is not responding causing the user to click the button multiple times.&lt;/p&gt;
&lt;p&gt;In ASP.NET it is most simple to disable a button on click, and still post back to the page.&lt;br /&gt;
Here is how we can do this with an ASP.NET button.&lt;/p&gt;
&lt;p&gt;First we'll create some Javascript to disable the button, but still call it's post back reference.&lt;br /&gt;
WE have to do this because once we disable a button, it stops the post back from occurring,&lt;br /&gt;
Let's create a button and take advantage of its OnClientClick property.&lt;br /&gt;
This property calls client side code before the page posts back.&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;&amp;lt;&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;Button&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="btnDoSomething"&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;Text&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="Go"&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;OnClick&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="btnDoSomething_Click"&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;OnClientClick&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="disableAndPost()"/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;Now we can create a javascript block on the page to disable this button yet still call it's post back.&lt;br /&gt;
I'm going to use a Javascript and Inline C# script to accomplish this, but there are many ways you can do it.&lt;br /&gt;
I use inline script to retrieve the button's ID which is generated at runtime by ASP.NET, as well as call it's post back event reference.&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;&amp;lt;&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;script&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;language&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="javascript"&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;type&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;="text/javascript"&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;!--&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;   function&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; disableAndPost()&lt;br /&gt;
   {&lt;br /&gt;
      &amp;lt;%= ClientScript.GetPostBackEventReference(btnDoSomething, &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;""&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;) %&amp;gt;;&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;
      document.getElementById(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;'&amp;lt;%=btnDoSomething.ClientID %&amp;gt;'&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).disabled=&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;"disabled"&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;
   }&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;script&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;Our first line calls the buttons post back event reference, the second line disables the button preventing it from being clicked again.&lt;/p&gt;
&lt;p&gt;A nice added extra is once the page reloads, the button is no longer disabled as ASP.NET re-renders the page unaware of the client side property added to the button.&lt;/p&gt;
&lt;p&gt;The next step would be to show a loading message or graphic during post back.&lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/6.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/09/02/disable-button-on-post-back.aspx</guid>
            <pubDate>Tue, 02 Sep 2008 05:22:30 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/09/02/disable-button-on-post-back.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/6.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ASP.NET Custom Error not throwing 404</title>
            <category>Web Development</category>
            <link>http://www.webdude.co.za/archive/2008/08/27/asp.net-custom-error-not-throwing-404.aspx</link>
            <description>&lt;p&gt;So I had an issue with Google the other day when I noticed my site was no longer verified.&lt;br /&gt;
So I went through the general process of verifying but Google complained that it was not seeing a 404 with the following message &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;We've detected that your 404 (file not found) error page returns a status of 200 (Success) in the header &lt;/p&gt;
&lt;/blockquote&gt;Now I found this very strange, as my custom errors handle my 404 so what's the problem. I had setup my web.config as follows: &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&amp;lt;&lt;font color="#800000" size="2"&gt;customErrors&lt;/font&gt; &lt;font color="#ff0000" size="2"&gt;mode&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;"On" &lt;font color="#ff0000" size="2"&gt;defaultRedirect&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;strong&gt;"/Error/"&lt;/strong&gt;&lt;/font&gt;&amp;gt;&lt;br /&gt;
   &amp;lt;&lt;font color="#800000" size="2"&gt;error&lt;/font&gt; &lt;font color="#ff0000" size="2"&gt;statusCode&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;"404" &lt;font color="#ff0000" size="2"&gt;redirect&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;strong&gt;"/404/"&lt;/strong&gt;&lt;/font&gt; /&amp;gt;&lt;br /&gt;
&amp;lt;/&lt;font color="#800000" size="2"&gt;customError&lt;/font&gt;&amp;gt; &lt;/p&gt;
&lt;/blockquote&gt;So back to using Fiddler, I reviewed the status codes being returned when hitting my 404 page.&lt;br /&gt;
No suprise, a 302 was being returned instead of a 404. More specifically, in my rewriting environment this was returning a 200 which google was complaining about.&lt;br /&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;img alt="" src="http://webdude.co.za/images/custom/Fiddler3.jpg" /&gt; &lt;/p&gt;
&lt;/blockquote&gt;Now this only occurred when running in IIS, and when the missing page ended with an extension handled by the aspnet_isapi.dll.&lt;br /&gt;
So with re-writing turned on, that's EVERYPAGE in my entire website. Great!&lt;br /&gt;
Now as a side note, In Casini Web Server it seems a 302 is always thrown. So you can only replicate this through IIS.&lt;br /&gt;
&lt;br /&gt;
So, onto &lt;strong&gt;THE FIX&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Quite a simple one, we just need to specify the status code on our 404 page.&lt;br /&gt;
So I use a WebForm as my 404 and I can now set the status code in the code behind: &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;Response.StatusCode = 404; &lt;/p&gt;
&lt;/blockquote&gt;This immediately fixed my problem and Google is happy again ... Don't we all love making Google happy&lt;br /&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;img alt="" src="http://webdude.co.za/images/custom/Fiddler4.jpg" /&gt; &lt;/p&gt;
&lt;/blockquote&gt;I searched around for a way to do this in an HTML file, but could not find one. If anyone knows please comment and I'll update the post.
&lt;p&gt; &lt;/p&gt;&lt;img src="http://www.webdude.co.za/aggbug/5.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>WebDude</dc:creator>
            <guid>http://www.webdude.co.za/archive/2008/08/27/asp.net-custom-error-not-throwing-404.aspx</guid>
            <pubDate>Wed, 27 Aug 2008 10:59:04 GMT</pubDate>
            <comments>http://www.webdude.co.za/archive/2008/08/27/asp.net-custom-error-not-throwing-404.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://www.webdude.co.za/comments/commentRss/5.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>