<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">
    <channel>
        <title>Chris Hynes's .NET Gallimaufry </title>
        <link>http://programcsharp.com/blog/Default.aspx</link>
        <description>.NET and stuff</description>
        <language>en-US</language>
        <copyright>Chris Hynes</copyright>
        <generator>Subtext Version 2.1.0.5</generator>
        <image>
            <title>Chris Hynes's .NET Gallimaufry </title>
            <url>http://programcsharp.com/blog/images/RSS2Image.gif</url>
            <link>http://programcsharp.com/blog/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/chrishynes" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
            <title>SQL 2008 installation issues</title>
            <category>General</category>
            <link>http://programcsharp.com/blog/archive/2009/10/13/21518.aspx</link>
            <description>&lt;p&gt;With every new SQL version, it seems there are more and more headaches getting it installed, unless you're installing it on a clean OS install. I ran into error after error trying to install on a Vista box that had been upgraded to Windows 7 and had SQL 2005 already installed.&lt;/p&gt;
&lt;p&gt;I finally dug up a blog entry that helped me out on Mark Michaelis's blog. It took a bit of digging, so I figured I'd give him a bit of google juice: &lt;a href="http://mark.michaelis.net/Blog/SQLServer2008InstallNightmare.aspx"&gt;SQL 2008 install registry issues and uninstall rollback techniques&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21518.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=GFSdZ18Dek4:YcTqwqR85s4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=GFSdZ18Dek4:YcTqwqR85s4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=GFSdZ18Dek4:YcTqwqR85s4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=GFSdZ18Dek4:YcTqwqR85s4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=GFSdZ18Dek4:YcTqwqR85s4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=GFSdZ18Dek4:YcTqwqR85s4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=GFSdZ18Dek4:YcTqwqR85s4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2009/10/13/21518.aspx</guid>
            <pubDate>Wed, 14 Oct 2009 03:57:36 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21518.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2009/10/13/21518.aspx#feedback</comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21518.aspx</wfw:commentRss>
        </item>
        <item>
            <title>How to use iBatis/NHibernate in medium trust/partial trust environments like Mosso</title>
            <category>ASP.NET</category>
            <category>General</category>
            <link>http://programcsharp.com/blog/archive/2009/08/19/ibatis-nhibernate-mosso-medium-trust-partial-trust-environments.aspx</link>
            <description>&lt;p&gt;
Many shared hosting providers (in this case Mosso) run your ASP.NET applications in a medium trust or modified medium trust environment to reduce security risks. This causes issues with certain techniques and components that require permissions removed by medium trust.
&lt;/p&gt;
&lt;p&gt;One of the biggest issues other than the actual restriction of permissions is the restriction of partially trusted assemblies calling fully trusted code. By default, if an assembly is strong named, partially trusted assemblies (i.e. the application assemblies in your app running under medium/partial trust) can't call it. This hits many open source components such as iBatis and NHibernate. The workaround to this is to add the AllowPartiallyTrustedCallers assembly level attribute. This will mark the assembly as safe for calling by partially trusted assemblies.
&lt;/p&gt;
&lt;p&gt;Here is an example of how to modify iBatis to support this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the iBatis source from the iBatis website: &lt;a href="http://ibatis.apache.org/dotnet.cgi"&gt;http://ibatis.apache.org/dotnet.cgi&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Extract the source .zip to a folder&lt;/li&gt;
&lt;li&gt;Open the IBatisNet.2005.sln solution in VS.NET&lt;/li&gt;
&lt;li&gt;For each project in the solution, open it's AssemblyInfo.cs file
&lt;ol&gt;
&lt;li&gt;Add this using statement at the top of the file: "using System.Security;"&lt;/li&gt;
&lt;li&gt;Add this attribute at the bottom of the file: "[assembly: AllowPartiallyTrustedCallers]"&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;Right click on the solution and select "Configuration Manager..."&lt;/li&gt;
&lt;li&gt;In the "Active solution configuration" dropdown, select Release&lt;/li&gt;
&lt;li&gt;Uncheck all of the Test projects&lt;/li&gt;
&lt;li&gt;Click OK&lt;/li&gt;
&lt;li&gt;Build the solution&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Or you can download the compiled assemblies: &lt;a href="http://krystalware.com/programcsharp/iBatis-PartialTrust.zip"&gt;iBatis-PartialTrust.zip&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;Enabling NHibernate for medium/partial trust is a similar procedure. If there is enough demand I will present steps and compiled assemblies for it as well.&lt;/p&gt;
&lt;p&gt;
As for the permission restrictions, most shared hosting providers don't actually run in medium trust as this restricts many useful things such as Reflection etc. One example I've run into recently is Mosso's modified medium trust. They take medium trust, which consists of the following denied permission restrictions:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Call unmanaged code.&lt;/li&gt;
&lt;li&gt;Call serviced components.&lt;/li&gt;
&lt;li&gt;Write to the event log.&lt;/li&gt;
&lt;li&gt;Access Microsoft Message Queuing queues.&lt;/li&gt;
&lt;li&gt;Access ODBC, OleDb, or Oracle data sources.&lt;/li&gt;
&lt;li&gt;Access files outside the application directory.&lt;/li&gt;
&lt;li&gt;Access the registry.&lt;/li&gt;
&lt;li&gt;Make network or Web service calls (using the System.Net.HttpWebRequest class, for example).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And then Mosso adds back in the following allowed permission to come up with "modified medium trust":
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;WebPermission Unrestricted="true"&lt;/li&gt;
&lt;li&gt;OleDbPermission Unrestricted="true"&lt;/li&gt;
&lt;li&gt;OdbcPermission Unrestricted="true"&lt;/li&gt;
&lt;li&gt;SocketPermission Unrestricted="true"&lt;/li&gt;
&lt;li&gt;ConfigurationPermission Unrestricted="true"&lt;/li&gt;
&lt;li&gt;ReflectionPermission Unrestricted="true"&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is still rather limiting, but at least you can get most things done as long as you can call into the necessary assemblies without getting exceptions as discussed in the workaround section above.&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21517.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=B2M_emgq-R8:Oasw-ezlfzo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=B2M_emgq-R8:Oasw-ezlfzo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=B2M_emgq-R8:Oasw-ezlfzo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=B2M_emgq-R8:Oasw-ezlfzo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=B2M_emgq-R8:Oasw-ezlfzo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=B2M_emgq-R8:Oasw-ezlfzo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=B2M_emgq-R8:Oasw-ezlfzo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2009/08/19/ibatis-nhibernate-mosso-medium-trust-partial-trust-environments.aspx</guid>
            <pubDate>Wed, 19 Aug 2009 20:04:29 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21517.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2009/08/19/ibatis-nhibernate-mosso-medium-trust-partial-trust-environments.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21517.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Optimize Windows Vista for blazing speed</title>
            <category>General</category>
            <link>http://programcsharp.com/blog/archive/2009/05/18/optimize-windows-vista-for-blazing-speed.aspx</link>
            <description>&lt;p&gt;I was working on one of my old laptops the other day, and realized it seemed just as fast as my newer laptop. The newer box is substantially higher specced - dual core proc, 4GB RAM, nVidia graphics etc. For awhile, I couldn't put my finger on just what the difference was, and then it hit me: the old laptop had Aero turned off. I turned off Aero on the new box and bam, it was noticably more snappy. Windows popped in instantly, menus snapped up with no hesitation. Not just a little improvement, but a drastic improvement in speed. You don't get the glitzy glass interface, but it's definitely worth the graphical loss to have a much faster experience.&lt;/p&gt;
&lt;p&gt;I haven't tested this on beefier desktop systems, but it gives a great improvement on laptops.&lt;/p&gt;
&lt;p&gt;Here are the steps:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Open the computer settings window (quickest way to do this is to right click on "My Computer" and select "Properties").&lt;/li&gt;
    &lt;li&gt;Click "Advanced system settings" on the left under Tasks&lt;/li&gt;
    &lt;li&gt;Go to the Advanced tab&lt;/li&gt;
    &lt;li&gt;Click the Settings button under the Performance item&lt;/li&gt;
    &lt;li&gt;On the Visual Effects tab, Select "Adjust for best performance"&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This will optimize the visual effects for the best performance, but some important visual effects will be missing - especially font smoothing. To get to the optimal settings, check the following items in the list:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Show preview and filters in folder&lt;/li&gt;
    &lt;li&gt;Show thumbnails instead of icons&lt;/li&gt;
    &lt;li&gt;Show window contents while dragging&lt;/li&gt;
    &lt;li&gt;Smooth edges of screen fonts&lt;/li&gt;
    &lt;li&gt;Smooth-scroll list boxes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The resulting selection will look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="367" height="528" src="http://krystalware.com/programcsharp/perfselected.png" /&gt;&lt;/p&gt;
&lt;p&gt;Click the OK button, and Windows will recalibrate itself for the new settings.&lt;/p&gt;
&lt;p&gt;Enjoy the new snappier performance!&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21516.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=9ZvSctaprbc:VZiP0KaoxR4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=9ZvSctaprbc:VZiP0KaoxR4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=9ZvSctaprbc:VZiP0KaoxR4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=9ZvSctaprbc:VZiP0KaoxR4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=9ZvSctaprbc:VZiP0KaoxR4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=9ZvSctaprbc:VZiP0KaoxR4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=9ZvSctaprbc:VZiP0KaoxR4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2009/05/18/optimize-windows-vista-for-blazing-speed.aspx</guid>
            <pubDate>Mon, 18 May 2009 21:17:23 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21516.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2009/05/18/optimize-windows-vista-for-blazing-speed.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21516.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Test if MasterPage ContentPlaceHolder has content or is empty</title>
            <category>ASP.NET</category>
            <link>http://programcsharp.com/blog/archive/2009/01/22/test-if-masterpage-contentplaceholder-has-content-or-is-empty.aspx</link>
            <description>&lt;p&gt;UPDATE: Thanks to &lt;a rel="nofollow" href="http://infomason.org"&gt;Jon Hynes of InfoMason&lt;/a&gt;, added functionality to support nested master pages. Code updates &lt;font style="BACKGROUND-COLOR: #00ffff"&gt;highlighted&lt;/font&gt;.&lt;/p&gt;
&lt;p&gt;I've seen several articles on the web that lay out a method for checking to see if a ContentPlaceHolder has any content or is empty. These work some of the time but unfortunately fall down in certain situations – like a placeholder that contains an embedded literal code block for example.&lt;/p&gt;
&lt;p&gt;In this case, there is no publicly exposed method that will provide the answer and no way to assemble any information that would tell us whether the ContentPlaceHolder is empty or has content. Fortunately, there is an internal .NET framework property that gives exactly what we need. A little reflection magic and we have a method that works in all circumstances.&lt;/p&gt;
&lt;p&gt;The MasterPage has a property called ContentTemplates that is a dictionary of all content templates that have been generated by the content page. If we check this, we can determine whether in fact the ContentPlaceHolder has been overridden by the content page. This, combined with the control check gives us a method that tells us if the ContentPlaceHolder has anything in it.&lt;/p&gt;
&lt;p&gt;This means we have three methods that work together to provide the resulting boolean. First, a method to check if there are any non empty controls in the ContentPlaceHolder:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;public static bool HasNonEmptyControls(ContentPlaceHolder cph)&lt;br /&gt;
{&lt;br /&gt;
    if (cph.Controls.Count == 0)&lt;br /&gt;
    {&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
    else if (cph.Controls.Count == 1)&lt;br /&gt;
    {&lt;br /&gt;
        LiteralControl c = cph.Controls[0] as LiteralControl;&lt;br /&gt;
&lt;br /&gt;
        if (string.IsNullOrEmpty(c.Text) || IsWhiteSpace(c.Text))&lt;br /&gt;
            return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static bool IsWhiteSpace(string s)&lt;br /&gt;
{&lt;br /&gt;
    for (int i = 0; i &amp;lt; s.Length; i++)&lt;br /&gt;
        if (!char.IsWhiteSpace(s[i]))&lt;br /&gt;
            return false;&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;Next, a method to check if the ContentPlaceHolder has a content template defined on the content page:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;static readonly Type _masterType = typeof(MasterPage);&lt;br /&gt;
static readonly PropertyInfo _contentTemplatesProp = _masterType.GetProperty("ContentTemplates", BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Instance);&lt;br /&gt;
&lt;br /&gt;
public static bool HasContentPageContent(ContentPlaceHolder cph)&lt;br /&gt;
{&lt;br /&gt;
&lt;font style="BACKGROUND-COLOR: #00ffff"&gt;    IDictionary templates = null;&lt;br /&gt;
    MasterPage master = cph.Page.Master;&lt;br /&gt;
&lt;br /&gt;
    while (templates == null &amp;amp;&amp;amp; master != null)&lt;br /&gt;
    {&lt;br /&gt;
        templates = (IDictionary)_contentTemplatesProp.GetValue(master, null);&lt;br /&gt;
        master = master.Master;&lt;br /&gt;
    }&lt;/font&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;font style="BACKGROUND-COLOR: #00ffff"&gt;    if (templates == null)&lt;br /&gt;
        return false;&lt;br /&gt;
&lt;/font&gt;&lt;br /&gt;
    bool isSpecified = false;&lt;br /&gt;
&lt;br /&gt;
    foreach (string key in templates.Keys)&lt;br /&gt;
    {&lt;br /&gt;
        if (key == cph.ID)&lt;br /&gt;
        {&lt;br /&gt;
            isSpecified = true;&lt;br /&gt;
&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return isSpecified;&lt;br /&gt;
}&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;This is where the reflection comes in. We grab the ContentTemplates dictionary off the MasterPage and check to see if the specified ContentPlaceHolder is defined.&lt;/p&gt;
&lt;p&gt;Finally, we call both methods to come to a final determination of whether the ContentPlaceHolder is empty or has content defined:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;public static bool HasContentOrControls(ContentPlaceHolder cph)&lt;br /&gt;
{&lt;br /&gt;
    return HasNonEmptyControls(cph) || HasContentPageContent(cph);&lt;br /&gt;
}&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;This code will all run on .NET 2.0 and above. If you are using .NET 3.5, you can use the following extension method to add this to the ContentPlaceHolder itself:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;public static bool HasContentOrControls(this ContentPlaceHolder cph)&lt;br /&gt;
{&lt;br /&gt;
    return MasterHelper.HasContentOrControls(cph);&lt;br /&gt;
}&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;a rel="nofollow" href="http://krystalware.com/programcsharp/MasterHelper-Source.zip"&gt;&lt;img height="16" alt="" width="16" border="0" src="http://krystalware.com/images/icon-cs.png" /&gt;MasterHelper source&lt;/a&gt;&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/2.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=ZhgprQ09"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=5TRNHDKH"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=5TRNHDKH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=7Iqg0UOt"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=7Iqg0UOt" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=fjMfgCSw"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=fjMfgCSw" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2009/01/22/test-if-masterpage-contentplaceholder-has-content-or-is-empty.aspx</guid>
            <pubDate>Thu, 22 Jan 2009 19:12:01 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/2.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2009/01/22/test-if-masterpage-contentplaceholder-has-content-or-is-empty.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/2.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Blog Moved!</title>
            <category>General</category>
            <link>http://programcsharp.com/blog/archive/2009/01/22/21515.aspx</link>
            <description>&lt;p&gt;I've moved all my technical posts into this blog -- &lt;a href="http://programcsharp.com"&gt;Chris Hynes's .NET Gallimaufry&lt;/a&gt;. The RSS url for this is &lt;a href="http://feeds.feedburner.com/ChrisHynes"&gt;http://feeds.feedburner.com/ChrisHynes&lt;/a&gt;. Company news and related posts will remain at the &lt;a href="http://krystalware.com/blog/"&gt;Krystalware Blog&lt;/a&gt;, with RSS here: &lt;a href="http://feeds.feedburner.com/krystalware"&gt;http://feeds.feedburner.com/krystalware&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21515.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=1RUkCS3G"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=hLsB1nrR"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=hLsB1nrR" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=SrtmljES"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=SrtmljES" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=vJVaM06I"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=vJVaM06I" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2009/01/22/21515.aspx</guid>
            <pubDate>Thu, 22 Jan 2009 18:40:10 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21515.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2009/01/22/21515.aspx#feedback</comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21515.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Do or do not. There is no try.</title>
            <category>General</category>
            <link>http://programcsharp.com/blog/archive/2008/03/03/Do-or-do-not.-There-is-no-try.aspx</link>
            <description>&lt;p&gt;This was originally going to be a comment on Tynan's post &lt;a rel="nofollow" href="http://www.betterthanyourboyfriend.com/just-doing-it.htm"&gt;Just Doing It&lt;/a&gt;, but it developed into something longer so I decided to do a full blown post here.&lt;/p&gt;
&lt;p&gt;I totally agree about the doing without thinking and emotion concept. Just do it. It's a matter of focus and drive. Its not something you're born with, its a skill you develop. Make a goal and outline the steps it takes to get there. Then its simple -- just follow the steps you laid out for yourself.&lt;/p&gt;
&lt;p&gt;The key for me is the second step -- making a list of things that need to be done to achieve the goal. Without a list, you can get to nebulous states where you don't really know what to do, don't feel like thinking about what to do, and just end up not doing anything at all. If you keep track of everything that you have to do in detailed lists, you always have something to do. Even if you're not feeling creative, just pick a simple item off the list and do it. Check it off. Once you do one item, more often than not I've found you want to do another. And another. And then you're back in the groove, kicking ass.&lt;/p&gt;
&lt;p&gt;I've never been a meticulous kind of person that would keep lists of everything. I'd always prefer to list stuff in my head. I've found that its so valuable, its worth the time to create lists. It keeps you focused on what you're doing, instead of trying to remember stuff you need to do. Everything is all in a list so your brain doesn't have to expend effort subconsciously remembering future tasks.&lt;/p&gt;
&lt;p&gt;This is the one recommendation I have: Make a goal and lists the steps to get it done. Then do it. If you've seen me on messenger, you'll know my tagline recently has been (as Yoda said), "Do or do not. There is no try." This is the attitude that breeds success.&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21513.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=VTHNFrt2"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=Mm4l70PJ"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=Mm4l70PJ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=rS1UmYni"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=rS1UmYni" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=r5q0tq2R"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=r5q0tq2R" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2008/03/03/Do-or-do-not.-There-is-no-try.aspx</guid>
            <pubDate>Mon, 03 Mar 2008 17:49:58 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21513.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2008/03/03/Do-or-do-not.-There-is-no-try.aspx#feedback</comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21513.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Import from Community Server to AspNetForum</title>
            <category>ASP.NET</category>
            <category>General</category>
            <category>SQL</category>
            <category>Tools</category>
            <link>http://programcsharp.com/blog/archive/2008/02/12/Import-from-Community-Server-to-AspNetForum.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;UPDATE: Added support for importing tracked forums and topics.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I'm in the process of converting my forums from &lt;a rel="nofollow" href="http://communityserver.org/"&gt;Community Server&lt;/a&gt; to &lt;a rel="nofollow" href="http://www.jitbit.com/asp-net-forum.aspx"&gt;AspNetForum&lt;/a&gt;. While CS may support every single feature under the sun, its very big and unwieldly to work with. The more recent 2007 and 2008 versions are better, but still behemoth. I just want to drop in one simple forum with a couple subgroups, not host a million forums and blogs on my site. For this, AspNetForum fits the bill exactly.&lt;/p&gt;
&lt;p&gt;There's no official importer for Community Server to AspNetForum, so I wrote my own. It turns out to be fairly simple. Just a SQL script will do it. Here are the steps the script goes through:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Import the ASP.NET application, user, and membership tables &lt;/li&gt;
    &lt;li&gt;Create the AspNetForum single sign-on linkages in its ForumUsers table &lt;/li&gt;
    &lt;li&gt;Import the groups, forums, topics, and messages &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I packaged all this up into a SQL script that handles the whole process end to end. Just edit it to point to your database and forums and it will do the rest. It assumes the following:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;You've created and set up an AspNetForum database &lt;/li&gt;
    &lt;li&gt;You've created the ASP.NET user and membership tables in the AspNetForum database &lt;/li&gt;
    &lt;li&gt;The AspNetForum and ASP.NET user and membership tables are new and empty &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This script will import everything with the same ID values from Community Server, making mapping or redirecting easy.&lt;/p&gt;
&lt;p&gt;To use the script in SQL Management Studio, do the following steps:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Open the script (Import.sql) and connect it to your AspNetForum database &lt;/li&gt;
    &lt;li&gt;Execute a search and replace operation that replaces "CSDatabaseName" with the name of your Community Server database &lt;/li&gt;
    &lt;li&gt;Set the @applicationId variable to the ApplicationId matching your Community Server instance in the aspnet_Applications table in your CS database &lt;/li&gt;
    &lt;li&gt;Set the @groupId variable to the GroupId of the forum group to import from the cs_Groups table &lt;/li&gt;
    &lt;li&gt;Execute the script &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Download the script and get importing! – &lt;a rel="nofollow" href="http://krystalware.com/programcsharp/CommunityServer2AspNetForumsImport.zip"&gt;CommunityServer2AspNetForumsImport.zip&lt;/a&gt;&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21512.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=pO4yfzvz"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=VNbuB6ji"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=VNbuB6ji" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=NHVA4eE3"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=NHVA4eE3" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=MSBwhss4"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=MSBwhss4" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2008/02/12/Import-from-Community-Server-to-AspNetForum.aspx</guid>
            <pubDate>Tue, 12 Feb 2008 16:20:21 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21512.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2008/02/12/Import-from-Community-Server-to-AspNetForum.aspx#feedback</comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21512.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Deep file and folder/directory copy in .NET</title>
            <category>ASP.NET</category>
            <category>Client</category>
            <category>Code</category>
            <link>http://programcsharp.com/blog/archive/2008/01/28/deep-file-and-folderdirectory-copy-in-.net.aspx</link>
            <description>&lt;p&gt;I just ran up against a requirement to do a deep file and folder/directory copy in .NET (C# to be exact). A quick google didn't turn up any code, so I figured I'd post what I came up with. This is a somewhat naive implementation that may run out of steam for very deep folders or 1000s of files, but works great for most things. This implementation takes a source folder and a destination folder and copies the entire structure including files and folders from the source folder to the destination.&lt;/p&gt;
&lt;p&gt;So without further ado:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;&lt;font color="#0000ff"&gt;private void&lt;/font&gt; CopyFolder(&lt;font color="#0000ff"&gt;string&lt;/font&gt; folder, &lt;font color="#0000ff"&gt;string&lt;/font&gt; destFolder)&lt;br /&gt;
{&lt;br /&gt;
  &lt;font color="#008080"&gt;Directory&lt;/font&gt;.CreateDirectory(destFolder);&lt;br /&gt;
&lt;br /&gt;
  &lt;font color="#0000ff"&gt;foreach&lt;/font&gt; (&lt;font color="#0000ff"&gt;string&lt;/font&gt; file &lt;font color="#0000ff"&gt;in&lt;/font&gt; &lt;font color="#008080"&gt;Directory&lt;/font&gt;.GetFiles(folder, "*.*", SearchOption.AllDirectories))&lt;br /&gt;
  {&lt;br /&gt;
    &lt;font color="#0000ff"&gt;string&lt;/font&gt; fileName = &lt;font color="#008080"&gt;Path&lt;/font&gt;.GetFileName(file);&lt;br /&gt;
    &lt;font color="#0000ff"&gt;string&lt;/font&gt; filePath = &lt;font color="#008080"&gt;Path&lt;/font&gt;.GetDirectoryName(file.Substring(folder.Length + (folder.EndsWith(&lt;font color="#a31515"&gt;"\\"&lt;/font&gt;) ? 0 : 1)));&lt;br /&gt;
    &lt;font color="#0000ff"&gt;string&lt;/font&gt; destFilePath;&lt;br /&gt;
&lt;br /&gt;
    &lt;font color="#0000ff"&gt;if&lt;/font&gt; (!&lt;font color="#0000ff"&gt;string&lt;/font&gt;.IsNullOrEmpty(filePath))&lt;br /&gt;
    {&lt;br /&gt;
      &lt;font color="#0000ff"&gt;string&lt;/font&gt; destFolderPath = &lt;font color="#008080"&gt;Path&lt;/font&gt;.Combine(destFolder, filePath);&lt;br /&gt;
&lt;br /&gt;
      &lt;font color="#008080"&gt;Directory&lt;/font&gt;.CreateDirectory(destFolderPath);&lt;br /&gt;
&lt;br /&gt;
      destFilePath = &lt;font color="#008080"&gt;Path&lt;/font&gt;.Combine(destFolderPath, fileName);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;font color="#0000ff"&gt;else&lt;/font&gt;&lt;br /&gt;
    {&lt;br /&gt;
      destFilePath = &lt;font color="#008080"&gt;Path&lt;/font&gt;.Combine(destFolder, fileName);&lt;br /&gt;
    }        &lt;br /&gt;
&lt;br /&gt;
    &lt;font color="#008080"&gt;File&lt;/font&gt;.Copy(file, destFilePath);&lt;br /&gt;
  }&lt;br /&gt;
} &lt;/code&gt;&lt;/blockquote&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21511.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=jqqotqwVVUs:10N9-5NgSt8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=jqqotqwVVUs:10N9-5NgSt8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=jqqotqwVVUs:10N9-5NgSt8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=jqqotqwVVUs:10N9-5NgSt8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=jqqotqwVVUs:10N9-5NgSt8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/chrishynes?a=jqqotqwVVUs:10N9-5NgSt8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/chrishynes?i=jqqotqwVVUs:10N9-5NgSt8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2008/01/28/deep-file-and-folderdirectory-copy-in-.net.aspx</guid>
            <pubDate>Mon, 28 Jan 2008 19:24:13 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21511.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2008/01/28/deep-file-and-folderdirectory-copy-in-.net.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21511.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Get the MIME type of a System.Drawing Image</title>
            <category>ASP.NET</category>
            <category>Code</category>
            <category>Imaging</category>
            <link>http://programcsharp.com/blog/archive/2008/01/17/Get-the-MIME-type-of-a-System.Drawing-Image.aspx</link>
            <description>&lt;p&gt;I needed a method to get the mime type of a System.Drawing Image instance that I'd loaded from an upload. All articles I was able to find online suggest some kind of lookup table solution. There's actually another way. Given an Image i, you can map from the i.RawFormat.Guid property to an ImageCodecInfo.FormatID. So it becomes a very simple for loop to get the MIME type of an image or bitmap. This works for any format System.Drawing/GDI+ supports (bmp, png, tiff, jpg/jpeg, etc). Here's the code:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;&lt;font color="#3366ff"&gt;&lt;font color="#0000ff"&gt;public static string&lt;/font&gt; &lt;/font&gt;GetMimeType(&lt;font color="#008080"&gt;Image &lt;/font&gt;i)&lt;br /&gt;
{&lt;br /&gt;
    &lt;font color="#0000ff"&gt;foreach&lt;/font&gt; (&lt;font color="#008080"&gt;ImageCodecInfo&lt;/font&gt; codec &lt;font color="#0000ff"&gt;in &lt;/font&gt;&lt;font color="#008080"&gt;ImageCodecInfo&lt;/font&gt;.GetImageDecoders())&lt;br /&gt;
    {&lt;br /&gt;
        &lt;font color="#0000ff"&gt;if&lt;/font&gt; (codec.FormatID == i.RawFormat.Guid)&lt;br /&gt;
            &lt;font color="#0000ff"&gt;return&lt;/font&gt; codec.MimeType;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#800000"&gt;"image/unknown"&lt;/font&gt;;&lt;br /&gt;
}&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;This won't work for images that were created on the fly (will return "image/unknown"), but will work for all images that were loaded from some source (file, stream, byte[], etc).&lt;/p&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21510.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=W3C9Bpow"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=5u3WqIPK"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=5u3WqIPK" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=hZ2vannI"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=hZ2vannI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=70RYIc8O"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=70RYIc8O" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2008/01/17/Get-the-MIME-type-of-a-System.Drawing-Image.aspx</guid>
            <pubDate>Thu, 17 Jan 2008 17:10:18 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21510.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2008/01/17/Get-the-MIME-type-of-a-System.Drawing-Image.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21510.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Recursively find ASP.NET controls by type with generics</title>
            <category>ASP.NET</category>
            <category>Code</category>
            <link>http://programcsharp.com/blog/archive/2008/01/02/Recursively-find-controls-by-type-with-generics.aspx</link>
            <description>&lt;p&gt;Sometimes you want to work with all controls on an ASP.NET page by type rather than id. I finally got fed up with the lack of builtin support, and wrote the following method that returns all controls inside another control (or page) by type:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt; List&amp;lt;T&amp;gt; FindControls&amp;lt;T&amp;gt;(&lt;span style="COLOR: #339966"&gt;Control&lt;/span&gt; parent) &lt;span style="COLOR: #0000ff"&gt;where&lt;/span&gt; &amp;lt;T&amp;gt; : &lt;span style="COLOR: #339966"&gt;Control&lt;/span&gt;&lt;br /&gt;
{&lt;br /&gt;
    &lt;span style="COLOR: #339966"&gt;List&lt;/span&gt;&amp;lt;T&amp;gt; foundControls = new &lt;span style="COLOR: #339966"&gt;List&lt;/span&gt;&amp;lt;T&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
    FindControls&amp;lt;T&amp;gt;(parent, foundControls);&lt;br /&gt;
&lt;br /&gt;
    &lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt; foundControls;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt; FindControls&amp;lt;T&amp;gt;(&lt;span style="COLOR: #339966"&gt;Control&lt;/span&gt; parent, &lt;span style="COLOR: #339966"&gt;List&lt;/span&gt;&amp;lt;T&amp;gt; foundControls) &lt;span style="COLOR: #0000ff"&gt;where&lt;/span&gt; &amp;lt;T&amp;gt; : &lt;span style="COLOR: #339966"&gt;Control&lt;/span&gt;&lt;br /&gt;
{&lt;br /&gt;
    &lt;span style="COLOR: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="COLOR: #339966"&gt;Control&lt;/span&gt; c &lt;span style="COLOR: #0000ff"&gt;in&lt;/span&gt; parent.Controls)&lt;br /&gt;
    {&lt;br /&gt;
        &lt;span style="COLOR: #0000ff"&gt;if&lt;/span&gt; (c &lt;span style="COLOR: #0000ff"&gt;is&lt;/span&gt; &amp;lt;T&amp;gt;)&lt;br /&gt;
            foundControls.Add((&amp;lt;T&amp;gt;)c);&lt;br /&gt;
        &lt;span style="COLOR: #0000ff"&gt;else if &lt;/span&gt;(c.Controls.Count &amp;gt; 0)&lt;br /&gt;
            FindControls&amp;lt;T&amp;gt;(parent, foundControls);                &lt;br /&gt;
    }&lt;br /&gt;
}&lt;/code&gt;&lt;/blockquote&gt;&lt;img src="http://programcsharp.com/blog/aggbug/21509.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=PV5IRZuS"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=C3j6UY0Z"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=C3j6UY0Z" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=BeGwj0JT"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=BeGwj0JT" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/chrishynes?a=sFryZ7iX"&gt;&lt;img src="http://feeds.feedburner.com/~f/chrishynes?i=sFryZ7iX" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            <dc:creator>Chris Hynes</dc:creator>
            <guid>http://programcsharp.com/blog/archive/2008/01/02/Recursively-find-controls-by-type-with-generics.aspx</guid>
            <pubDate>Wed, 02 Jan 2008 21:37:51 GMT</pubDate>
            <wfw:comment>http://programcsharp.com/blog/comments/21509.aspx</wfw:comment>
            <comments>http://programcsharp.com/blog/archive/2008/01/02/Recursively-find-controls-by-type-with-generics.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://programcsharp.com/blog/comments/commentRss/21509.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
