<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Code, Articles, Discussion on Microsoft Technologies</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/mahuja/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/mahuja/feed.xml</link>
    <description>The learnings on technologies I work upon ...</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:03:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>“A selected drive is no longer valid”–Error while Adding/Removing Features from Visual Studio 2008</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/a-selected-drive-is-no-longer-validerror-while-addingremoving-features-from-visual-studio-2008</link>
      <pubDate>Mon, 15 Nov 2010 01:57:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2010/11/15/a-selected-drive-is-no-longer-validerror-while-addingremoving-features-from-visual-studio-2008/</guid>
      <description><![CDATA[You may face this error while Adding / Removing features from Visual Studio 2008 if SP1 is already...]]></description>
      <content:encoded><![CDATA[<p>You may face this error while Adding / Removing features from Visual Studio 2008 if SP1 is already installed. One of the workaround is to uninstall SP1 before this operation and install it again after performing this operation. However, this can be tedious.</p>  <p>There is a hotfix which addresses the Upgrade issue for the product setup launched from Windows Add/Remove Programs dialog. Visual Studio 2008 setup launched from installation media remains unaffected.</p>  <p>The hotfix can be downloaded from here:</p>  <p><a title="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=27638" href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=27638">https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=27638</a></p>  <p>There is another issue where in the maintenance mode of Visual Studio might ask for a file called <em>SQLSysClrTypes.msi.</em>This file is present in Visual Studio SP1 package. The workaround for this solution is given here:</p>  <p><a href="https://blogs.msdn.com/b/heaths/archive/2009/02/02/feature-changes-in-visual-studio-2008-sp1-may-prompt-for-sqlsysclrtypes-msi.aspx?wa=wsignin1.0">https://blogs.msdn.com/b/heaths/archive/2009/02/02/feature-changes-in-visual-studio-2008-sp1-may-prompt-for-sqlsysclrtypes-msi.aspx?wa=wsignin1.0</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Sharepoint Saturday in India! Apr 24 (Live Online!)</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/sharepoint-saturday-in-india-apr-24-live-online</link>
      <pubDate>Tue, 23 Feb 2010 08:47:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2010/02/23/sharepoint-saturday-in-india-apr-24-live-online/</guid>
      <description><![CDATA[
]]></description>
      <content:encoded><![CDATA[<div style="display: inline;"><iframe src="https://spsindia.eventbrite.com?ref=eweb" mce_src="https://spsindia.eventbrite.com?ref=eweb" marginwidth="5" marginheight="5" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="1000" scrolling="auto" width="980"></iframe><a href="https://www.eventbrite.com/r/eweb" mce_href="https://www.eventbrite.com/r/eweb"><img src="https://www.eventbrite.com/s.gif" mce_src="https://www.eventbrite.com/s.gif" alt="Events" border="0"></a></div>
]]></content:encoded>
    </item>
    <item>
      <title>System.MissingMethodException: Method Not Found when running unit Tests</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/system-missingmethodexception-method-not-found-when-running-unit-tests</link>
      <pubDate>Sun, 04 Jan 2009 02:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2009/01/04/system-missingmethodexception-method-not-found-when-running-unit-tests/</guid>
      <description><![CDATA[Lately, I have been doing Test Driven development in my development projects. I have noticed a...]]></description>
      <content:encoded><![CDATA[<p>Lately, I have been doing Test Driven development in my development projects. I have noticed a strange issue which occurs especially when the code coverage is enabled for the assemblies. The result is , unit tests works normally in Debug mode and do not behave as expected when run in Normal mode.</p>  <p>I have noticed the bug logged for this on Connect website:</p>  <p><a title="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=123306" href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=123306">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=123306</a></p>  <p>&#160;</p>  <p>Meanwhile, the workaround for this is to do a full release build of the solution before running unit tests in Normal mode.I guess this is because, Normal run uses the release version of assemblies as opposed to Debug versions, and if the Release assemblies are either old or missing, they are bound to fail.</p>  <p>&#160;</p>  <p>[Update 6/01/09]</p>  <p>Rory had left a comment on this post and provided the excellent and absolute solution for this. This is quoted in his own words and here is the <a href="https://www.neovolve.com/post/2008/01/30/incorrect-code-coverage-references-in-testrunconfig.aspx" target="_blank">link</a> to his blog post. Thanks Rory !!!</p>  <p><em>The issue is encountered because the testrunconfig points code coverage at assemblies using a relative path that includes the build configuration output directory.</em></p>  <p><em>If the testrunconfig points to bin\Debug\YourAssembly.dll and you make a change to the methods in Debug and a test for it, then change to Release without a Debug build and run the unit tests, then the new tests won't find the methods in the assembly identified in the code coverage configuration.</em></p>  <p><em>See </em><a href="https://www.neovolve.com/post/2008/01/30/incorrect-code-coverage-references-in-testrunconfig.aspx"><em>https://www.neovolve.com/post/2008/01/30/incorrect-code-coverage-references-in-testrunconfig.aspx</em></a></p>  <p><em>The fix is to manually edit the testrunconfig to replace the build configuration part of the path with $(OutDir). This will mean that the assemblies will work with any build configuration.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Adding Client script to TreeNode Click Event</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/adding-client-script-to-treenode-click-event</link>
      <pubDate>Sat, 29 Nov 2008 11:55:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/11/29/adding-client-script-to-treenode-click-event/</guid>
      <description><![CDATA[Most of the ASP.NET 2.0 controls provide way to add client events to them. For example, TextBoxes,...]]></description>
      <content:encoded><![CDATA[<p>Most of the ASP.NET 2.0 controls provide way to add client events to them. For example, TextBoxes, checkbox are simply rendered as &lt;input&gt; elements and can be easily hooked to JavaScript functions either programmatically or declaratively.</p>  <p>However, TreeNode is a special case in that. There is no straightforward way to hookup client events to it. This is simply because they are rendered as Anchor &lt;a&gt; elements and its href and onClick attributes are itself consumed by ASP.NET framework. </p>  <p>However, with a little trick, the TreeNode element can be easily hooked up to client events.</p>  <p>The key to this solution is TreeNode’s PreRenderText and PostRenderText methods. The framework describes it as : </p>  <p>   <br /><a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenode.renderposttext.aspx">RenderPostText</a>: Allows control developers to add additional rendering to the node. </p>  <p>   <br /><a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenode.renderpretext.aspx">RenderPreText</a>: Allows control developers to add additional rendering to the node. </p>  <p>Using these methods, we can inject a simple &lt;div&gt; tag and enclose our Nodes(&lt;a&gt;) in those. For example:</p>  <div>   <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CTreeNode : TreeNode</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">{</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    <span style="color: #0000ff">protected</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">void</span> RenderPreText(HtmlTextWriter writer)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">&#160;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        writer.Write(<span style="color: #006080">&quot;&lt;div onclick='CheckUnsavedStatus(this);'&gt;&quot;</span>);</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        <span style="color: #0000ff">base</span>.RenderPreText(writer);</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    }</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">&#160;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    <span style="color: #0000ff">public</span> CTreeNode(<span style="color: #0000ff">string</span> label, <span style="color: #0000ff">string</span> <span style="color: #0000ff">value</span>)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        <span style="color: #0000ff">this</span>.Text = label;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        <span style="color: #0000ff">this</span>.Value = <span style="color: #0000ff">value</span>;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&#160;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    }</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&#160;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    <span style="color: #0000ff">protected</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">void</span> RenderPostText(HtmlTextWriter writer)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        writer.Write(<span style="color: #006080">&quot;&lt;/div&gt;&quot;</span>);</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        <span style="color: #0000ff">base</span>.RenderPostText(writer);</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    }</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&#160;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">}</pre>
  </div>
</div>

<p>The code above will call the CheckUnsavedStatus client function passing it the reference of &lt;div&gt; element. Using this &lt;div&gt; element, we can alter our Node(&lt;a&gt; element) at the client side.</p>

<p>For example, We might want to call the server side event <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.selectednodechanged.aspx">SelectedNodeChanged</a>, only if user has saved its changes. The client script for this kind of scenario would be:</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">function</span> CheckUnsavedStatus(divObj)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"> {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                <span style="color: #0000ff">var</span> HiddenSaveDataCheckObj=document.getElementById(<span style="color: #006080">'&lt;%=hiddenSaveDataCheck.ClientID %&gt;'</span>);</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">                <span style="color: #0000ff">if</span>(HiddenSaveDataCheckObj==<span style="color: #0000ff">null</span>)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                    <span style="color: #0000ff">return</span>;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">                <span style="color: #0000ff">if</span>(HiddenSaveDataCheckObj.value==<span style="color: #006080">'1'</span>)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">                    <span style="color: #0000ff">var</span> response=confirm(<span style="color: #006080">'There are pending changes. Click Ok to continue and lose the changes'</span>);</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                    <span style="color: #0000ff">if</span>(response==<span style="color: #0000ff">false</span>)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">                    {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                         divObj.children[0].href=<span style="color: #006080">'#'</span>;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">                         <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                    }</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">                        </pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">                }    </pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">}</pre>
  </div>
</div>

<p>The function above changes the target link of node to # which suppresses the server side call and subsequently the postback. Here, hiddenSaveDataCheck is a HiddenField which tracks the save/unsaved status.</p>

<p>Note that:</p>

<p>To preserve the custom script generation on postback, the CreateNode method of TreeView control must be overrideen to return our CustomNode rather than default TreeNode implementation. This is easy:</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CustomTreeView:TreeView</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">    {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">        <span style="color: #0000ff">protected</span> <span style="color: #0000ff">override</span> TreeNode CreateNode()</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        {</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">            <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> CTreeNode();</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">        }</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">    }</pre>
  </div>
</div>

<p>Another important thing to be kept in mind is SelectAction property of TreeNode. This property determines, what happens when you click a TreeNode. This is an enumeration described as : </p>

<p><strong>TreeNodeSelectAction.Expand</strong> : Toggles the node between expanded and collapsed. Raises the <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.treenodeexpanded.aspx">TreeNodeExpanded</a> event or the <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.treenodecollapsed.aspx">TreeNodeCollapsed</a> event as appropriate. </p>

<p><strong>TreeNodeSelectAction</strong>.<strong>None</strong>: Raises no events when a node is selected. </p>

<p><strong>TreeNodeSelectAction.Select</strong>: Raises the <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.selectednodechanged.aspx">SelectedNodeChanged</a> event when a node is selected. </p>

<p><strong>TreeNodeSelectAction.SelectExpand</strong>: Raises both the <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.selectednodechanged.aspx">SelectedNodeChanged</a> and the <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.treenodeexpanded.aspx">TreeNodeExpanded</a> events when a node is selected. Nodes are only expanded, never collapsed. </p>

<p>This solution will work for all the cases irrespective of the setting, however it hardly makes it any sense to set it as TreeNodeSelectAction.None, since in this case, node is not rendered as hyperlink. For only client event, it should&#160; preferably be set to TreeNodeSelectAction.Select. Since this also causes&#160; a server side event <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.selectednodechanged.aspx">SelectedNodeChanged</a>, we can suppress the postback in our client function as discussed above.</p>]]></content:encoded>
    </item>
    <item>
      <title>Resolving Common issues while Applying Site Templates (.stp) on MOSS 2007</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/resolving-common-issues-while-applying-site-templates-stp-on-moss-2007</link>
      <pubDate>Tue, 14 Oct 2008 08:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/10/14/resolving-common-issues-while-applying-site-templates-stp-on-moss-2007/</guid>
      <description><![CDATA[Lately, I have been working a lot with site templates in MOSS 2007. I have seen common issues which...]]></description>
      <content:encoded><![CDATA[<p>Lately, I have been working a lot with site templates in MOSS 2007. I have seen common issues which keep occurring now and then. I am posting the resolution of those since you might also run across them frequently.</p>  <p>&#160;</p>  <p><strong>File Cannot be found</strong></p>  <ul>   <li>This one is easy. In 99% of the cases, this usually occurs due to missing master page. If the site template has been created out of a site having a custom master page and if that master page is not present in the target machine, be ready to face this error. It can be simply resolved by uploading the required master page in Master page gallery of the target site collection.      <br />      <br /></li>    <li>Note that, if the site template contains custom webparts or user controls, this error would also come if the assembly for those controls is not found. Resolution would be to simply put the correct assemblies in bin directory of the target application and update the <font face="Courier New">web.config </font>with <font face="Courier New">&lt;safecontrol&gt;</font> entries.       <br />      <br /></li>    <li>You would also face the same error if the site template is a Publishing site and one of the pages in its Pages Library have been built out of a custom Page Layout. The reason is simple, page layouts are not packaged in the site template. There is no resolution to this error. You might get away by uploading the required page layout in the page layouts gallery of the target site collection , but I recommend against it. That’s one of the reasons, Microsoft does not officially support saving Publishing Sites as Template (The link in Site Settings disappears when you activate Publishing feature :)). </li> </ul>  <p>&#160;</p>  <h4><strong>The template you have chosen is invalid or cannot be found</strong></h4>  <ul>   <li>If you are trying to apply the custom site template (programmatically) and if the template is not present. </li> </ul>  <blockquote>   <p><strong>Resolution:</strong></p> </blockquote>  <blockquote>   <p>Add the new template by using <font face="Courier New">stsadm –o addtemplate –filename &lt;filename.stp&gt; –title &lt;title&gt;</font></p> </blockquote>  <ul>   <li>You can also get this error when applying the template through GUI. Obviously, the template is present but sharepoint is somehow finding it to be invalid. One of the reasons for this could be version mismatch. You cannot restore the template created out of SP1 to a non-SP1 installation of MOSS. </li> </ul>  <blockquote>   <p><strong>Resolution</strong>: Upgrade the source server and re-create the template.</p> </blockquote>  <blockquote>   <p>(I am not sure if the template created from non-SP version can be applied to SP1 installation of MOSS).</p> </blockquote>  <ul>   <li>Thirdly, this error also comes when you have feature dependency missing. Basically the site from which the template was created has one or more custom feature activated on it which are not present on the target installation. </li> </ul>  <blockquote>   <p><strong>Resolution:</strong></p> </blockquote>  <blockquote>   <p>If you know the missing feature, install the feature on the target machine.</p> </blockquote>  <blockquote>   <p>However, even if you have made sure that you have all the required features present and are still facing this error, it can be easily debugged.</p> </blockquote>  <blockquote>   <p>Rename the .stp file to .cab file and extract manifest.xml out of it. If we open the manifest.xml, it would contain the list of dependent feature ids in a section like this:</p> </blockquote>  <blockquote>   <div>     <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">       <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">SiteFeatures</span><span style="color: #0000ff">&gt;</span></pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;a392da98-270b-4e85-9769-04c0fde267aa&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;f6924d36-2fa8-4f0b-b16d-06b7250180fa&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;695b6570-a48b-4a8e-8ea5-26ea7fc1d162&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;89e0306d-453b-4ec5-8d68-42067cdbf98e&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ca7bd552-10b1-4563-85b9-5ed1d39c962a&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;d3f51be2-38a8-4e44-ba84-940d35be1566&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;aebc918d-b20f-4a11-a1db-9ed84d79c87e&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;00bfea71-1c5e-4a24-b310-ba51c3eb7a57&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;bf120348-ef6f-4526-a9a8-d4f4b897c790&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">SiteFeatures</span><span style="color: #0000ff">&gt;</span></pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">WebFeatures</span><span style="color: #0000ff">&gt;</span></pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;00bfea71-c796-4402-9f2f-0eb9a6e71b18&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;29d85c25-170c-4df9-a641-12db0b9d4130&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;00bfea71-5932-4f9c-ad71-1557e5751100&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;00bfea71-4ea5-48d4-a4ad-305cf7030140&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Feature</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;00bfea71-f600-43f6-a895-40c0de7b0117&quot;</span> <span style="color: #0000ff">/&gt;</span> </pre>

      <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">WebFeatures</span><span style="color: #0000ff">&gt;</span></pre>
    </div>
  </div>
</blockquote>

<blockquote>
  <p>The feature IDs listed under SiteFeatures tag&#160; are the site collection features on which the site&#160; was dependent upon when the site template was saved as a template. </p>
</blockquote>

<blockquote>
  <p>Similarly, As you might have guessed, features IDs listed under WebFeatures tag are Site features on which the template was dependent.</p>
</blockquote>

<blockquote>
  <p>Armed with this information, you can simply do a text search on Features folder of your target installation to see which feature is missing and deploy-activate the missing feature on the target machine. Usually, I have seen custom feature are at the bottom of the list and out of the box features are at the top, but don’t take this observation to be granted in your case :).</p>

  <p align="left">If you know of any other resolutions, or fighting/fought with any similar issue , do leave me a comment and I’ll update my post (along with credits ofcourse).</p>
</blockquote>

<p>Cheers,</p>

<p>Madhur</p>]]></content:encoded>
    </item>
    <item>
      <title>Use right tools for x64 machines</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/use-right-tools-for-x64-machines</link>
      <pubDate>Tue, 14 Oct 2008 07:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/10/14/use-right-tools-for-x64-machines/</guid>
      <description><![CDATA[If you are setting up a x64 server for MOSS, there are some things to be taken care of. I ran into...]]></description>
      <content:encoded><![CDATA[<p>If you are setting up a x64 server for MOSS, there are some things to be taken care of. I ran into couple of issues while setting up my development machine and had a hard time debugging it.</p>  <ul>   <li>While registering ASP.NET 2.0 framework with IIS, make sure to use 64 bit version of aspnet_regiis.exe. This binary would be located at </li> </ul>  <blockquote>   <p>%systemdrive%\WINDOWS\Microsoft.NET\Framework64\v2.0.50727</p> </blockquote>  <blockquote>   <p>If you are in habit of using 32 bit version for long time, you might mistakenly use the one located at<font face="Courier New" size="3"> %systemdrive%\WINDOWS\Microsoft.NET\Framework\v2.0.50727.</font></p> </blockquote>  <blockquote>   <p>Note that this directory is present even if you only install X64 version of .NET Framework for compatibility reasons.&#160; But running this command would only give you error unless you enable 32 bit worker process on the IIS. This can be done by setting the following value in IIS metabase from the command prompt.</p> </blockquote>  <blockquote>   <p><font face="Courier New">cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64</font></p> </blockquote>  <p>&#160;</p>  <ul>   <li>Even the Visual Studio SDK tools are different for x64 versions. On a 64 bit machine, running sn.exe –Vr or Sn.exe –Vl&#160; to skip the signature verification on assemblies will not have any effect.&#160; Use the correct versions located at: </li> </ul>  <blockquote>   <p><font face="Courier New" size="3">%systemdrive%\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64.</font></p> </blockquote>  <blockquote>   <p>This point is worth mentioning because, VS 2005/2008 by default sets the PATH environment variable to 32 bit binaries regardless of the architecture.</p></blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Managed Debugging and inspecting Jitted code With WinDbg</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/managed-debugging-and-inspecting-jitted-code-with-windbg</link>
      <pubDate>Wed, 16 Jul 2008 11:34:43 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/07/16/managed-debugging-and-inspecting-jitted-code-with-windbg/</guid>
      <description><![CDATA[WinDbg is a powerful tool to debug applications. Lately, its use has been extended to managed...]]></description>
      <content:encoded><![CDATA[<p>WinDbg is a powerful tool to debug applications. Lately, its use has been extended to managed debugging as well through an extension called sos.dll (Son of Strike). Sos.dll is shipped with both .NET Framework 2.0 and .NET 1.1 Framework and is a WinDbg extension which allows WinDbg to read managed data structures such as Method Tables, Method Descriptors etc. The power of WinDbg is ultimate in detecting memory leaks, deadlocks and unexpected application crashes where Visual Studio debugger cannot reach. </p>  <p>In this post, we will try to debug and inspect the Jitted code for a very simple .NET console application. Note that WinDbg is new to me as well, so if there is any better or shorter way to do this, kindly leave a comment to me.</p>  <p><font face="Courier New"></font></p>  <p><font face="Courier New"></font></p>  <div class="csharpcode">   <pre class="alt"><span class="kwrd">namespace</span> ConsoleApplication1</pre>

  <pre>{</pre>

  <pre class="alt">    <span class="kwrd">class</span> Test</pre>

  <pre>    {</pre>

  <pre class="alt">        <span class="kwrd">public</span> <span class="kwrd">int</span> i;</pre>

  <pre>        <span class="kwrd">public</span> <span class="kwrd">int</span> ri()</pre>

  <pre class="alt">        {</pre>

  <pre>            i++;</pre>

  <pre class="alt">            <span class="kwrd">return</span> i;</pre>

  <pre>        }</pre>

  <pre class="alt">    }</pre>

  <pre>    <span class="kwrd">class</span> Program</pre>

  <pre class="alt">    {</pre>

  <pre>        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)</pre>

  <pre class="alt">        {</pre>

  <pre>            Test t = <span class="kwrd">new</span> Test();</pre>

  <pre class="alt">&#160;</pre>

  <pre>            <span class="kwrd">int</span> y = t.ri();</pre>

  <pre class="alt">&#160;</pre>

  <pre>            Console.Write(y);</pre>

  <pre class="alt">        }</pre>

  <pre>    }</pre>

  <pre class="alt">}</pre>
</div>
<style type="text/css">





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>Upon loading this ConsoleApplication1.exe into debugger, WinDbg breaks at the default debug breakpoint. At this point .NET runtime is not loaded into memory, so SOS cannot be loaded at this moment. We will set a breakpoint on Module load of mscorlib.dll, so that we can load SOS.</p>

<p>Entering the command <strong>sxe ld:mscorlib</strong> sets this breakpoint. Once it is set, we will go ahead with F5 to run the application. WinDbg will break upon loading on mscorlib.dll :</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">ModLoad: 790c0000 79bf6000   C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\32e6f703c114f3a971cbe706586e3655\mscorlib.ni.dll
eax=00000001 ebx=00000000 ecx=00000001 edx=00000000 esi=7ffdf000 edi=20000000
eip=7c82ed54 esp=0012e9d0 ebp=0012ea14 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
ntdll!KiFastSystemCallRet:
7c82ed54 c3              ret</pre>
</div>

<p>At this point, SOS can be loaded into memory, with the command <strong>.loadby sos mscorwks</strong></p>

<p>Once the SOS is loaded, we can inspect the running threads using <strong>!threads</strong> </p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><p>!threads</p><p>PDB symbol <span style="color: #0000ff">for</span> mscorwks.dll not loaded
ThreadCount: 2
UnstartedThread: 1
BackgroundThread: 1
PendingThread: 1
DeadThread: 0
Hosted Runtime: no
                                      PreEmptive   GC Alloc           Lock
       ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception
   0    1  1c4 00181fd0       220 Enabled  00000000:00000000 0014cf28     1 Ukn
XXXX    2  9d4 001533b8      1400 Enabled  00000000:00000000 0014cf28     0 Ukn (Finalizer)
</p></pre>
</div>

<p>We can see from the output above that there is one AppDomain at 0014cf28 loaded for the current running process, which makes sense since it is a very simple application.</p>

<p>Lets dump the domain information using <strong>!dumpdomain 014cf28</strong></p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><p>!dumpdomain 014cf28</p><p>Domain 1: 0014cf28
LowFrequencyHeap: 0014cf4c
HighFrequencyHeap: 0014cfa4
StubHeap: 0014cffc
Stage: OPEN
SecurityDescriptor: 0014e258
Name: None
</p></pre>
</div>

<p>Dumping the domain gives us information about the locations of heaps. Note that it also gives the managed loaded modules in the process, but there is none listed since no managed module has been loaded yet (mscorlib is about to be loaded). We can set another breakpoint in WinDbg till the jitting engine (mscorjit.dll) is loaded using <strong>sxe ld:mscorjit</strong></p>

<p>The breakpoint is hit as soon as mscorjit.dll is loaded:</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">ModLoad: 79060000 790b6000   C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll
eax=00000001 ebx=00000000 ecx=00000001 edx=00000000 esi=7ffdf000 edi=20000000
eip=7c82ed54 esp=0012e554 ebp=0012e598 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
ntdll!KiFastSystemCallRet:
7c82ed54 c3              ret</pre>
</div>

<p>Now, if we dump the domain again, </p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">Domain 1: 0014cf28
LowFrequencyHeap: 0014cf4c
HighFrequencyHeap: 0014cfa4
StubHeap: 0014cffc
Stage: OPEN
SecurityDescriptor: 0014e258
Name: ConsoleApplication1.exe
Assembly: 00190558 [C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll]
ClassLoader: 001905f0
SecurityDescriptor: 0018cdc8
  Module Name
790c2000 C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll

Assembly: 00194388 [C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe]
ClassLoader: 00193720
SecurityDescriptor: 001942f0
  Module Name
008f2c3c C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe</pre>
</div>

<p>We can see that it lists, the mscorlib and our application(ConsoleApplication1.exe) as one of the loaded modules. Lets proceed onto setting the breakpoint on the Main() function. First we will need to get the address of method table of class Program by first dumping our module using <strong>!dumpmodule</strong> command. Once we get the method table, we can dump it using <strong>!dumpmt</strong> command to get the method descriptor for the Main() function.</p>

<p><strong>!dumpmodule -mt 008f2c3c</strong></p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><p>!dumpmodule -mt 008f2c3c</p><p>Name: C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe
Attributes: PEFile 
Assembly: 00194388
LoaderHeap: 00000000
TypeDefToMethodTableMap: 008f00c0
TypeRefToMethodTableMap: 008f00cc
MethodDefToDescMap: 008f0118
FieldDefToDescMap: 008f012c
MemberRefToDescMap: 008f0134
FileReferencesMap: 008f017c
AssemblyReferencesMap: 008f0180
MetaData start address: 00402098 (1548 bytes)

Types defined <span style="color: #0000ff">in</span> <span style="color: #0000ff">this</span> module

      MT    TypeDef Name
------------------------------------------------------------------------------
008f3038 0x02000003 ConsoleApplication1.Program

Types referenced <span style="color: #0000ff">in</span> <span style="color: #0000ff">this</span> module

      MT    TypeRef Name
------------------------------------------------------------------------------
790fd0f0 0x01000001 System.Object
</p></pre>
</div>

<p>We can dump the method table of ConsoleApplication1.Program using <strong>!dumpmt -md 008f3038</strong>. The parameter -md is for dumping MethodDesc table.</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><p>!dumpmt -md 008f3038</p><p>EEClass: 008f1278
Module: 008f2c3c
Name: ConsoleApplication1.Program
mdToken: 02000003  (C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe)
BaseSize: 0xc
ComponentSize: 0x0
Number of IFaces <span style="color: #0000ff">in</span> IFaceMap: 0
Slots <span style="color: #0000ff">in</span> VTable: 6
--------------------------------------
MethodDesc Table
   Entry MethodDesc      JIT Name
79371278   7914b928   PreJIT System.Object.ToString()
7936b3b0   7914b930   PreJIT System.Object.Equals(System.Object)
7936b3d0   7914b948   PreJIT System.Object.GetHashCode()
793624d0   7914b950   PreJIT System.Object.Finalize()
008fc010   008f3028     NONE ConsoleApplication1.Program.Main(System.String[])
008fc01c   008f3030     NONE ConsoleApplication1.Program..ctor()
</p></pre>
</div>

<p>We can see that method descriptor for Main resides at 008f3028.</p>

<p>We can set the breakpoint on Program.Main() method using <strong>!bpmd -md 008f3028</strong></p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">MethodDesc = 008f3028
Adding pending breakpoints...</pre>
</div>

<p>As we run the application, the breakpoint is hit and instruction pointer is placed on the first instruction of the jitted Main() method.</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">(a0c.1c4): CLR notification exception - code e0444143 (first chance)
JITTED ConsoleApplication1!ConsoleApplication1.Program.Main(System.String[])
Setting breakpoint: bp 00C20070 [ConsoleApplication1.Program.Main(System.String[])]
Breakpoint 0 hit
eax=008f3028 ebx=0012f4ac ecx=01241ec0 edx=00000000 esi=00181fd0 edi=00000000
eip=00c20070 esp=0012f484 ebp=0012f490 iopl=0         nv up ei pl nz ac po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000212
00c20070 56              push    esi</pre>
</div>

<p>Finally, to see the generated machine code, use the Unassemble instruction to unassemble the instructions starting from current.</p>

<p>!u eip</p>

<div>
  <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> Normal JIT generated code</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> ConsoleApplication1.Program.Main(System.String[])</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span> Begin 00c20070, size 35</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> &gt;&gt;&gt; 00c20070 56              push    esi</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span> 00c20071 b9b0308f00      mov     ecx,8F30B0h (MT: ConsoleApplication1.Test)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> 00c20076 e8a11f7dff      call    003f201c (JitHelp: CORINFO_HELP_NEWSFAST)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   7:</span> 00c2007b 8bd0            mov     edx,eax</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span> 00c2007d ff4204          inc     dword ptr [edx+4]</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   9:</span> 00c20080 8b7204          mov     esi,dword ptr [edx+4]</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> 00c20083 833d8c10240200  cmp     dword ptr ds:[224108Ch],0</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  11:</span> 00c2008a 750a            jne     00c20096</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span> 00c2008c b901000000      mov     ecx,1</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  13:</span> *** WARNING: Unable to verify checksum <span style="color: #0000ff">for</span> C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\32e6f703c114f3a971cbe706586e3655\mscorlib.ni.dll</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span> 00c20091 e8ce587478      call    mscorlib_ni+0x2a5964 (79365964) (System.Console.InitializeStdOutError(Boolean), mdToken: 06000770)</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  15:</span> 00c20096 8b0d8c102402    mov     ecx,dword ptr ds:[224108Ch]</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span> 00c2009c 8bd6            mov     edx,esi</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  17:</span> 00c2009e 8b01            mov     eax,dword ptr [ecx]</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span> 00c200a0 ff5074          call    dword ptr [eax+74h]</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  19:</span> 00c200a3 5e              pop     esi</pre>

    <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, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span> 00c200a4 c3              ret</pre>
  </div>
</div>

<p>Here are some interesting observations of this jitted code:</p>

<ul>
  <li>The call at line number 6 (call 003f201c (JitHelp: CORINFO_HELP_NEWSFAST) is a call to create the instance of any class. The parameter to this method is the method table address which we see being passed in previous line number in ecx. If we dump out that method table using !dumpmt , we will see that it points to class Test. 
    <br />

    <br /></li>

  <li>One might be wondering, once the Test Class is instantiated, where is the call to ri()? Interestingly, there is no call and the instructions are inlined as we see in line numbers 7 and 8. inc instruction is equivalent to i++. I do not exactly know why it has been inlined , perhaps may be because compiler optimizations were enabled in Visual Studio. Or if there are any rules governing the inlining, I do not know them yet. 
    <br />

    <br /></li>

  <li>Lines number 14 - 16 are simply initialization of Console to prepare it for emitting text using Write() method. This Write() method is finally called at line 18. If you set the breakpoint on line 18 and step through it, you will see 1 being outputted on your screen :) </li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Resolving Very Slow Symbol Loading with VS 2008 during debugging</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/resolving-very-slow-symbol-loading-with-vs-2008-during-debugging</link>
      <pubDate>Tue, 08 Jul 2008 04:47:27 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/07/08/resolving-very-slow-symbol-loading-with-vs-2008-during-debugging/</guid>
      <description><![CDATA[Recently, I was encountering insanely slow project loading times during debugging in Visual Studio...]]></description>
      <content:encoded><![CDATA[<p><font size="3"></font></p>  <p><font size="2">Recently, I was encountering insanely slow project loading times during debugging in Visual Studio 2008. Interestingly, this only happened while loading the project only in debug mode. Also, during the slow symbol loading time, the status bar at Visual Studio 2008 always showed <strong><em>Loading Symbols For ____.Dll</em></strong>. </font></p>  <p><font size="2">To track it down, I enabled logging for the VS 2008 IDE. This can be done by adding the following entries to its configuration file.</font></p>  <p><font size="2">1) Navigate to: <strong><em>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE</em></strong>&#160; in Windows Explorer </font></p>  <p><font size="2">2) Load <strong><em>devenv.exe.config</em></strong> in text editor.</font></p>  <p><font size="2">3) Add the following entries into it</font></p>  <pre>  &lt;system.diagnostics&gt;
        &lt;trace autoflush=&quot;true&quot; indentsize=&quot;4&quot;&gt;
            &lt;listeners&gt;
               &lt;add name=&quot;myListener&quot; 
type=&quot;System.Diagnostics.TextWriterTraceListener, System version=1.0.3300.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089&quot; 
initializeData=&quot;c:\myListener.log&quot; /&gt;
               &lt;remove name=&quot;Default&quot; /&gt;
            &lt;/listeners&gt;
        &lt;/trace&gt;
    &lt;/system.diagnostics&gt;</pre>

<pre><font face="Trebuchet MS" size="2">As per this configuration, the trace log would be saved to C:\myListener.Log. Now I fired up VS 2008 and loaded to project in debug mode to reproduce the issues.</font></pre>

<pre><font face="Trebuchet MS" size="2">I also ran couple of unit test cases in debug mode which were also not able to load. I opened the trace log and found these exceptions:</font></pre>

<p><font face="Courier New" size="2">[V, 5820, 7, 2008/07/04 14:00:33.412] devenv.exe: DIA thew in retrieving symbols: System.Runtime.InteropServices.COMException (0x806D0005): Exception from HRESULT: 0x806D0005 </font></p>

<p><font face="Courier New" size="2">at Microsoft.VisualStudio.TestTools.Common.Dia2Lib.IDiaDataSource.loadDataForExe(String executable, String searchPath, Object pCallback) </font></p>

<p><font face="Courier New" size="2">at Microsoft.VisualStudio.TestTools.Common.DiaHelper.GetSymbolsFileName(String imagePath)</font></p>

<p><font face="Trebuchet MS" size="2">Confirmed with the issue was related to loading of Symbols. I realized that I had once set up a dedicated symbol directory on machine at C:\symbols to enable debugging with WinDbg. </font></p>

<p><font face="Trebuchet MS" size="2">I checked the Debugging Options in VS 2008 to see if its trying to load symbols from somewhere else.</font></p>

<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="377" alt="Debug" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mahuja/WindowsLiveWriter/ResolvingVerySlowSymbolLoadingwithVS2008_AD94/Debug_5.jpg" original-url="https://blogs.msdn.com/blogfiles/mahuja/WindowsLiveWriter/ResolvingVerySlowSymbolLoadingwithVS2008_AD94/Debug_5.jpg" width="644" border="0" /> </p>

<p>&#160;</p>

<p><font face="Trebuchet MS" size="2">Then suddenly, I was reminded that I had once set up a environment variable _NT_SYMBOL_PATH to an Internet location while debugging in WinDbg to </font><font face="Trebuchet MS" size="2">enable automatic downloading of symbols. </font></p>

<p><font face="Trebuchet MS" size="2">I originally thought that this setting was only applicable to WinDbg. But I was mistaken. In fact, this setting will be used across by all debuggers </font><font face="Trebuchet MS" size="2">(atleast Microsoft debuggers). This is documented </font><a href="https://msdn.microsoft.com/en-us/library/cc266397.aspx" target="_blank"><font face="Trebuchet MS" size="2">here</font></a><font face="Trebuchet MS" size="2">. </font><font face="Trebuchet MS" size="2">I was pretty sure that VS 2008 was trying to load symbols from the Internet location and since many of the assemblies in my application didn't had </font><font face="Trebuchet MS" size="2">symbols were them, it must have been failing.</font></p>

<p><font face="Trebuchet MS" size="2">To confirm, I fired <strong>My Computer -&gt; Properties -&gt; Advanced -&gt; Environment Variables</strong> and cleared out the line</font></p>

<p><font face="Trebuchet MS" size="2"><strong>_NT_SYMBOL_PATH=srv*c:\mysymbols*https://msdl.microsoft.com/download/symbols;cache*c:\mysymbols</strong></font></p>

<p><font face="Trebuchet MS" size="2">I reloaded the my project in VS 2008 in debug mode and Bingo, the problem was solved :)</font></p>

<p><font face="Trebuchet MS" size="2">While investigating this problem, I came across many other sources which could cause this issue , so I thought I can post it here for the benefit </font><font face="Trebuchet MS" size="2">of community. The credit for these tips goes to Azeem Khan who is working with VSTS team at Microsoft.</font></p>

<ul>
  <li>Make sure that you don't have a symbol path specified in VS under <strong>Tools | Options | Debugging | Symbols</strong> and also, that you don't have the NT_SYMBOL_PATH environment variable set on your machine. 

    <br /></li>

  <li>Verify that you haven't specified any network shares under the same setting to server that do not exist anymore. This will require timeouts. 
    <br /></li>

  <li>Specify a local cache for symbols under the same setting. After you have downloaded symbols once from network shares you can disable those locations. Symbol loading will go a lot faster after the first attempt. 
    <br /></li>

  <li>Do not specify any symbol lookup paths at all either in environment variable and specify paths in the options page but specify that they be used for manual loading. You can then manually load symbols for modules you care about either via the context menu in call stack or the modules window. 
    <br /></li>

  <li>VS 2008 SP1 has made a few improvements in this area. It allows for canceling loading of symbols as it is happening. This will allow you to get to your debug session much faster. Note that this is currently in Beta. 
    <br /></li>

  <li>Clearing the breakpoints also serve to solve this problem for some people. </li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Showing Exchange Inbox in MOSS 2007</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/showing-exchange-inbox-in-moss-2007</link>
      <pubDate>Tue, 01 Jul 2008 12:05:22 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/07/01/showing-exchange-inbox-in-moss-2007/</guid>
      <description><![CDATA[Recently, I have seen a lot of discussions on forums about showing user's mailbox on a portal...]]></description>
      <content:encoded><![CDATA[<p>Recently, I have seen a lot of <a href="https://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2978413&amp;SiteID=17" target="_blank">discussions</a> on forums about showing user's mailbox on a portal homepage. This is very similar to the case in My Site, but in this case the portal is not My Site and the requirement is to let each user view his/her mailbox using the My Inbox Web Part.</p>  <p>Interestingly, I have seen developers writing custom Web Part for this requirement. In-fact, this is available totally out of the box.</p>  <p>If you are using Exchange 2007, you can just fill in the Exchange Server field in your Outlook Web Parts for MOSS 2007 and the Web Part will pickup the current user's mailbox automatically. </p>  <p>If you have a Exchange 2003 and SharePoint in your organization, this is one of the strong reason alone for going into Exchange 2007 upgrade, along with other benefits which Exchange 2007 provides. </p>  <p>However, If you are using Exchange 2003 and want to achieve this functionality, its easy to write the custom Web Part which automatically assigns the current user and exchange server to Web Part programmatically. But there are limitations of this approach which I will outline at the end of this post. This is simple code for the Web Part which can be used to assign the username and server name.</p>  <p>&#160;</p>  <p>using System;    <br />using System.Configuration;     <br />using System.Web;     <br />using System.Web.Security;     <br />using System.Web.UI;     <br />using System.Web.UI.WebControls;     <br />using System.Web.UI.WebControls.WebParts;     <br />using System.Web.UI.HtmlControls;     <br />using Microsoft.SharePoint.WebPartPages;     <br />using Microsoft.SharePoint.Portal.WebControls;</p>  <p>namespace SharePoint.Webparts    <br />{     <br />&#160;&#160;&#160; public class MyInboxEx : System.Web.UI.WebControls.WebParts.WebPart     <br />&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; protected override void CreateChildControls()     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create the instance of My Inbox Web Part    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; OWAInboxPart inbox = new OWAInboxPart();</p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Get and Assign the server name from web.config    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; inbox.OWAServerAddressRoot = ConfigurationSettings.AppSettings[&quot;SERVER_NAME&quot;];     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string userName = Page.Request.ServerVariables[&quot;LOGON_USER&quot;];     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string mailboxName = userName;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int pos = userName.IndexOf(&quot;\\&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (pos &gt; -1)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mailboxName = userName.Substring(pos + 1);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Assign the mailbox name </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; inbox.MailboxName = mailboxName;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Controls.Add(inbox);</p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p>&#160;&#160;&#160;&#160; }    <br />}</p>  <p>&#160;</p>  <p>In the above code, we can retrieve the server name of exchange server from any configuration store, I am using web.config &lt;AppSettings&gt; section here. Before using this code in any environment, its important to realize its limitations:</p>  <ul>   <li>The Web Part makes the assumption that the name of the mailbox is same as the username. Although, this is true for most of Exchange deployments, this is not true for all. I have seen deployments, where FirstName.LastName is used as name of the mailbox while username is entirely different.      <br /></li>    <li>In large Exchange deployments, there are multiple servers being used, and user's mailbox is located to geographically closest server. The Web Part does not take into account of this as we are using single hard coded server name for all the users. </li> </ul>  <p>Due to the reasons cited above, the usage of this approach is very limited to small deployments. I&#160; have seen this approach being used in one of the deployment at a University :)</p>  <p>Cheers,</p>  <p>Madhur</p>]]></content:encoded>
    </item>
    <item>
      <title>Switch the sharepoint webpart page Display Mode into Edit Mode and Vice Versa</title>
      <link>https://docs.microsoft.com/archive/blogs/mahuja/switch-the-sharepoint-webpart-page-display-mode-into-edit-mode-and-vice-versa</link>
      <pubDate>Tue, 01 Apr 2008 00:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Madhur Ahuja]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mahuja/2008/04/01/switch-the-sharepoint-webpart-page-display-mode-into-edit-mode-and-vice-versa/</guid>
      <description><![CDATA[Recently one of my clients had a requirement to go into Edit mode of a
sharepoint page using a...]]></description>
      <content:encoded><![CDATA[Recently one of my clients had a requirement to go into Edit mode of a
sharepoint page using a manual link displayed in quick launch. He was
lazy of going to Site Actions -&gt; Edit Page and then again going
somewhere else for Exit Edit Mode :)<br><br><p> To give some background for beginners, whenever we click Edit Page on Site Actions menu,<br>the pages switches into a different display mode called Design Mode. Its not a feature of<br>Sharepoint, but ASP.NET 2.0 Webparts Framework.<br><br></p><h2>Background</h2><br>According to the framework, the page can have 4 different modes:<br><ul><br><li>BrowseDisplayMode  : Represents the default display mode.<br></li><li>CatalogDisplayMode : Used for adding controls from a catalog of controls to a Web page<br></li><li>ConnectDisplayMode : Displays a special UI for users to manage connections between Web Part controls.<br></li><li>DesignDisplayMode  : Used for changing the layout of Web pages containing Web Part controls.<br></li><li>EditDisplayMode    : Displays a UI from which end users can edit and modify server controls<br><br></li></ul>The <code>WebPartManager</code>
control provides a programmatic interface, making it possible to switch
the Web Part Page between browse, design, and edit display modes.<br><p>For
example, to programmatically switch the current page into design mode,
you can simply add a link control with an event handler that sets the <code>DisplayMode</code> property to <code>DesignDisplayMode</code>.<br></p><pre><br>WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;<br></pre>Although
this would work technically, but it would not give up the visible
changes to page, like visibilty of Page Editing toolbar, webpart zones
etc.<br><p>This visual magic is done by lot of Javascript which is executed when we click Edit Page on Site Actions menu.<br><br>To build this link control, we need to figure out the javascript code which causes this behaviour.<br><br></p><p>This would be present in default.master. If we open Site Actions menu and do the View Source on IE.<br>Here is the code of our interest :<br><br></p><pre>&lt;td class="ms-siteactionsmenu" id="siteactiontd"&gt;<br>&lt;span&gt;&lt;a href="javascript:MSOLayout_ToggleLayoutMode();"&gt;Edit Page&lt;/a&gt;&lt;;/span&gt;<br></pre><p>As you must have figured out, its the <code>MSOLayout_ToggleLayoutMode()</code>
function which does all the magic of turning the current page into Edit
page. This javascript also calls the server side code which executes
this statement<br></p><p><br><code>WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;</code><br>//(This can also be demonstrated, but its beyond scope)<br><br></p><h2>Building the Webcontrol</h2><p>Armed with this knowledge, we can build a simple webcontrol which we will switch the page into Edit mode and vice versa.<br>Below is the code for the same. Its the simplest webcontrol you will see ever.<br></p><pre><br>using System;<br>using System.Web.UI.WebControls.WebParts;<br>using System.Web.UI.HtmlControls;<br>using System.Web.UI;<br>namespace SPUtil<br>{<br>public class SPEditMode:System.Web.UI.WebControls.WebControl<br>{<br>  HtmlAnchor btnLink;<br><br>  protected override void CreateChildControls()<br>  {<br>      WebPartManager wp = WebPartManager.GetCurrentWebPartManager(Page);<br><br>      const string url="javascript:MSOLayout_ToggleLayoutMode();";<br><br>      btnLink = new HtmlAnchor();<br><br>      if (wp.DisplayMode == WebPartManager.BrowseDisplayMode)<br><br>          btnLink.InnerText = "Edit Page";<br>      else if (wp.DisplayMode == WebPartManager.DesignDisplayMode)<br>          btnLink.InnerText = "Exit Edit Mode";<br>      else<br>          btnLink.Visible = false;<br><br>      btnLink.HRef = url;<br><br>      Controls.Add(btnLink);<br>      base.CreateChildControls();<br>  }<br><br>}<br>}<br><br></pre>I have used <code>HtmlAnchor</code> rather than <code>LinkButton</code> or <code>SPLinkButton</code> since its lightweight on the server and We are not performing any special processing which is present in server controls.<br><br>One
point to be worth noting: This link would be visible to all including
visitors. For used in practical scenarious, the control should be
hidden for other than members and Administrators.<br><br>I was using this link in user's MySite and hence I did not have that case :)<br>]]></content:encoded>
    </item>
  </channel>
</rss>