<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aneef.Net &#187; Aneef Fashir</title>
	<atom:link href="http://www.aneef.net/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aneef.net</link>
	<description>Do it in .Net way &#124; Blogging about C#,ASP.Net, LINQ,WPF and .Net Technologies</description>
	<lastBuildDate>Tue, 29 Nov 2011 13:18:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>I&#8217;m Still Alive :)</title>
		<link>http://www.aneef.net/2011/11/29/im-still-alive/</link>
		<comments>http://www.aneef.net/2011/11/29/im-still-alive/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 13:18:51 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=175</guid>
		<description><![CDATA[Hi All, I know its more than an year since i  wrote my last post here. got held up with loads of work during this period.  i always try to sit and write something, and end up filling my drafts folder *chuckles* . anyway its time to bring this site alive again. so hopefully ill [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Hi All,</p>
<p>I know its more than an year since i  wrote my last post here. got held up with loads of work during this period.  i always try to sit and write something, and end up filling my drafts folder *chuckles* <img src='http://www.aneef.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  . anyway its time to bring this site alive again. so hopefully ill be active again here. and will try to write some quality stuff which will help you all in some way.</p>
<p>Thanks,</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2011/11/29/im-still-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Presentation on ASP.Net WebMatrix for .Net User Group Meeting.</title>
		<link>http://www.aneef.net/2010/10/08/my-presentation-on-asp-net-webmatrix-for-net-user-group-meeting/</link>
		<comments>http://www.aneef.net/2010/10/08/my-presentation-on-asp-net-webmatrix-for-net-user-group-meeting/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 19:39:06 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WebMatrix]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[Slide Deck]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=163</guid>
		<description><![CDATA[Last Thursday i did a presentation on ASP.Net WebMatrix in the .Net User Group meeting held in Colombo.  so thought of  sharing the presentation with you all. there were some code demos also, but unfortunately i couldn&#8217;t upload them. if anyone is interested you can download and view the presentation in the link below or [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Last Thursday i did a presentation on ASP.Net WebMatrix in the .Net User Group meeting held in Colombo.  so thought of  sharing the presentation with you all. there were some code demos also, but unfortunately i couldn&#8217;t upload them. if anyone is interested you can download and view the presentation in the link below or view it in the Scribd document.</p>
<p>I must thank <a href="http://msjoe.com">Joe Stagner</a> from microsoft for his ScreenCasts and Presentation on WebMatrix, which were very helpful for me to prepare my presentation too.</p>
<p><a title="View Introduction to ASP.Net Webmatrix  on Scribd" href="http://www.scribd.com/doc/38973828/Introduction-to-ASP-Net-Webmatrix" style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block; text-decoration: underline;">Introduction to ASP.Net Webmatrix </a> <object id="doc_999476862154291" name="doc_999476862154291" height="(auto)" width="450" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf" style="outline:none;" ><param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"><param name="wmode" value="opaque"><param name="bgcolor" value="#ffffff"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="FlashVars" value="document_id=38973828&#038;access_key=key-1ihae2ucnh16imbmtbnw&#038;page=1&#038;viewMode=slideshow"><embed id="doc_999476862154291" name="doc_999476862154291" src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=38973828&#038;access_key=key-1ihae2ucnh16imbmtbnw&#038;page=1&#038;viewMode=slideshow" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="(auto)" width="450" wmode="opaque" bgcolor="#ffffff"></embed></object></p>
<p><a href="http://www.aneef.net/wp-content/uploads/2010/10/webmatrix_session.pptx">Download the Slide Deck here</a></p>
<p>Thanks,</p>
<p>Aneef</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/10/08/my-presentation-on-asp-net-webmatrix-for-net-user-group-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Youtube Helper for ASP.Net WebMatrix [UPDATED For Beta 2]</title>
		<link>http://www.aneef.net/2010/10/05/youtube-helper-for-asp-net-webmatrix/</link>
		<comments>http://www.aneef.net/2010/10/05/youtube-helper-for-asp-net-webmatrix/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 16:34:00 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WebMatrix]]></category>
		<category><![CDATA[Helper]]></category>
		<category><![CDATA[Razor]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=141</guid>
		<description><![CDATA[THIS POST IS UPDATED TO WORK WITH WEBMATRIX BETA 2 ASP.Net WebMatrix is a lightweight web development tool that contains IIS Express, SQL CE 4.0 and ASP.Net Web Pages with Razor Syntax. to learn more about ASP.Net WebMatrix read this excellent tutorial. The ASP.Net Web pages ships with some really cool helpers like easy database [...]]]></description>
			<content:encoded><![CDATA[<p></p><blockquote><p><strong>THIS POST IS UPDATED TO WORK WITH WEBMATRIX BETA 2</strong></p></blockquote>
<p><a href="http://www.asp.net/webmatrix" target="_blank">ASP.Net WebMatrix</a> is a lightweight web development tool that contains IIS Express, SQL CE 4.0 and ASP.Net Web Pages with Razor Syntax. to learn more about ASP.Net WebMatrix read this excellent <a href="http://www.asp.net/webmatrix/tutorials/1-getting-started-with-webmatrix-and-asp-net-web-pages">tutorial</a>.</p>
<p>The ASP.Net Web pages ships with some really cool helpers like easy database access, Twitter profile, &amp; Facebook like button.  and it also allows us to create our own helpers. in the current beta release of the WebMatrix there are 2 ways to create a helper:</p>
<ol>
<li>Using a visual studio class library (Recommended).</li>
<li>Use .cs file in the App_Code directory in the WebMatrix project folder.</li>
</ol>
<p>In this post I&#8217;m going to show you how to create a Helper to add <a href="http://www.youtube.com">Youtube </a>Videos to your WebMatrix pages. as you know a helper needs to be a static class. here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.Mvc</span><span style="color: #008000;">;</span> 
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.WebPages</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.Helpers</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> MyHelpers
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> IHtmlString Youtube<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> link, <span style="color: #6666cc; font-weight: bold;">int</span> width <span style="color: #008000;">=</span> <span style="color: #FF0000;">480</span>, <span style="color: #6666cc; font-weight: bold;">int</span> height <span style="color: #008000;">=</span> <span style="color: #FF0000;">385</span>, <span style="color: #6666cc; font-weight: bold;">bool</span> allowFullScreen <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span> innerHtml <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
        var url <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://www.youtube.com/v/{0}?fs=1&amp;amp;hl=en_US&quot;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">//prepare video embed URL</span>
        var uri <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>link<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        var querystring <span style="color: #008000;">=</span> uri<span style="color: #008000;">.</span><span style="color: #0000FF;">Query</span><span style="color: #008000;">;</span>
        var videoCode <span style="color: #008000;">=</span> HttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">ParseQueryString</span><span style="color: #008000;">&#40;</span>querystring<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Get</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;v&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        url <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span>url, videoCode<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">//prepare HTML</span>
        var html <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TagBuilder<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;object&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        html<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;width&quot;</span>, width<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        html<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;height&quot;</span>, height<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        var param1 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TagBuilder<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;param&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        param1<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;name&quot;</span>, <span style="color: #666666;">&quot;movie&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        param1<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;value&quot;</span>, url, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        var param2 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TagBuilder<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;param&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        param2<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;name&quot;</span>, <span style="color: #666666;">&quot;allowFullScreen&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        param2<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;value&quot;</span>, allowFullScreen<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        var param3 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TagBuilder<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;param&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        param3<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;name&quot;</span>, <span style="color: #666666;">&quot;allowscriptaccess&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        param3<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;value&quot;</span>, <span style="color: #666666;">&quot;always&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        var embed <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TagBuilder<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;embed&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        embed<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;src&quot;</span>, url, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        embed<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;type&quot;</span>, <span style="color: #666666;">&quot;application/x-shockwave-flash&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        embed<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;allowscriptaccess&quot;</span>, <span style="color: #666666;">&quot;always&quot;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        embed<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;allowfullscreen&quot;</span>, allowFullScreen<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        embed<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;width&quot;</span>, width<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        embed<span style="color: #008000;">.</span><span style="color: #0000FF;">MergeAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;height&quot;</span>, height<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        innerHtml <span style="color: #008000;">+=</span> param1<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>TagRenderMode<span style="color: #008000;">.</span><span style="color: #0000FF;">SelfClosing</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        innerHtml <span style="color: #008000;">+=</span> param2<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>TagRenderMode<span style="color: #008000;">.</span><span style="color: #0000FF;">SelfClosing</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        innerHtml <span style="color: #008000;">+=</span> param3<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>TagRenderMode<span style="color: #008000;">.</span><span style="color: #0000FF;">SelfClosing</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        innerHtml <span style="color: #008000;">+=</span> embed<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>TagRenderMode<span style="color: #008000;">.</span><span style="color: #0000FF;">SelfClosing</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        html<span style="color: #008000;">.</span><span style="color: #0000FF;">InnerHtml</span> <span style="color: #008000;">=</span> innerHtml<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> HtmlString<span style="color: #008000;">&#40;</span>html<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>TagRenderMode<span style="color: #008000;">.</span><span style="color: #0000FF;">Normal</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Few things to note in the above code.  i have referenced <a href="http://msdn.microsoft.com/en-us/library/dd492706.aspx" target="_blank">System.Web.Mvc</a> to use the <a href="http://www.asp.net/mvc/tutorials/using-the-tagbuilder-class-to-build-html-helpers-cs" target="_blank">TagBuilder</a> to create safe html, and System.Web.Helpers to create the helper. the second one, you can find in C:\program files\Microsfoft ASP.Net (or ASP.net installation directory).</p>
<p>And I&#8217;m using the <a href="http://msdn.microsoft.com/en-us/library/system.web.httputility.aspx" target="_blank">System.Web.HttpUtility</a> here to extract a query string from a Uri.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #008080; font-style: italic;">//prepare video embed URL</span>
        var uri <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>link<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        var querystring <span style="color: #008000;">=</span> uri<span style="color: #008000;">.</span><span style="color: #0000FF;">Query</span><span style="color: #008000;">;</span>
        var videoCode <span style="color: #008000;">=</span> HttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">ParseQueryString</span><span style="color: #008000;">&#40;</span>querystring<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Get</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;v&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>I use the above code to convert the Youtube public link to the actual video link.</p>
<p>And since my code needs to return an html which should not be html encoded again. my methods return type is <a href="http://msdn.microsoft.com/en-us/library/system.web.ihtmlstring.aspx" target="_blank">IHtmlstring</a>. using this tells the ASP.Net pages not to encoded this html again, as this is already encoded.</p>
<p>Now create the folder App_Code in your WebMatrix Project, and create a file named MyHelpers.cs and paste the code above in that.</p>
<p>Now you can use this in your WebPages like this to embed youtube videos in your pages:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">  @MyHelpers<span style="color: #008000;">.</span><span style="color: #0000FF;">Youtube</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;http://www.youtube.com/watch?v=ulzLU3At3lA&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Other parameters such as width,height are optional as you can notice we have used optional parameters.</p>
<p><strong>UPDATE</strong>S for beta 2:</p>
<ol>
<li>In beta 1 WebPages were in Microsoft.WebPages. but in WebMatrix beta 2 its moved to System.Web.WebPages</li>
<li>I had to copy System.Web.Mvc.dll to the bin directory of WebMatrix project to make this workin in WebMatrix beta 2.</li>
</ol>
<p>I Hope it helps</p>
<p>Aneef</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/10/05/youtube-helper-for-asp-net-webmatrix/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fix: .Net 2.0 or 3.5 Setup Project Requires .Net Framework version 4.0</title>
		<link>http://www.aneef.net/2010/05/24/fix-net-2-0-or-3-5-setup-project-requires-net-framework-version-4-0/</link>
		<comments>http://www.aneef.net/2010/05/24/fix-net-2-0-or-3-5-setup-project-requires-net-framework-version-4-0/#comments</comments>
		<pubDate>Mon, 24 May 2010 10:47:57 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Tricks & Tips]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[.NetFramework4.0]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=134</guid>
		<description><![CDATA[Sorry again folks again I was MIA with loads and loads of work. trust me i have more than 30 drafts which i started and never got time to finish. anyway coming to the point this morning i was trying to deploy a windows service project using the setup project templates in visual studio 2010, [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Sorry again folks again I was MIA with loads and loads of work. trust me i have more than 30 drafts which i started and never got time to finish. anyway coming to the point this morning i was trying to deploy a windows service project using the setup project templates in visual studio 2010, and when i tried to install it on client machine i got the following message:</p>
<p><a href="http://www.aneef.net/wp-content/uploads/2010/05/5-24-2010-4-00-44-PM.png"><img class="alignnone size-full wp-image-135" title="5-24-2010 4-00-44 PM" src="http://www.aneef.net/wp-content/uploads/2010/05/5-24-2010-4-00-44-PM.png" alt="The Setup Requires the .Net Framework version 4.0" width="446" height="166" /></a></p>
<p>But I&#8217;m pretty sure that i had the project targeted to .net Framework 3.5 SP1, but still it was  requiring .net 4.0.  as usual i did a Google search and found <a href="http://blogs.iis.net/ma_khan/archive/2009/12/02/troubleshooting-net-2-0-setup-requires-net-4-0-runtime.aspx" target="_blank">this article </a>with the trick to resolve it.</p>
<p>actually it was the dependencies in the setup project causing the issue, it was still targetting 4.0 even though my application targets .net 3.5 and by default VS2010 set the dependency to .Net 4.0.</p>
<p>if you have this issue all you have to do is the following :</p>
<ol>
<li>Double click on the dependencies of the setup project.</li>
<li>Click on the .Net Framework</li>
<li>And you will see the Property window will get enabled.</li>
<li>Change the Version property to your desired .net Framework ( in my case 3.5).</li>
<li>and build your setup again.</li>
</ol>
<p>That&#8217;s it <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>for the original article that gave me this solution <a href="http://blogs.iis.net/ma_khan/archive/2009/12/02/troubleshooting-net-2-0-setup-requires-net-4-0-runtime.aspx" target="_blank">visit here</a>.</p>
<p>Just thought i would share this information which that might be helpful for those developers who are in migration process to VS2010 <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . hope it help guys!!.</p>
<p>Thanks,</p>
<p>Aneef</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/05/24/fix-net-2-0-or-3-5-setup-project-requires-net-framework-version-4-0/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 RTM &amp; .Net framework 4.0 Final version released</title>
		<link>http://www.aneef.net/2010/04/12/visual-studio-2010-rtm-net-framework-4-0-final-version-released/</link>
		<comments>http://www.aneef.net/2010/04/12/visual-studio-2010-rtm-net-framework-4-0-final-version-released/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:09:26 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[bizspark]]></category>
		<category><![CDATA[visualstudio]]></category>
		<category><![CDATA[Websitespark]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=132</guid>
		<description><![CDATA[Its been a long time i wrote something on my blog, thanks to my busy work schedule i have a large number of drafts saved lolz. this is just a quick post Anyway today is another big day for .Net developers around the world, yeah the final version of visual studio 2010 is released.  visual [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Its been a long time i wrote something on my blog, thanks to my busy work schedule i have a large number of drafts saved lolz. this is just a quick post</p>
<p>Anyway today is another big day for .Net developers around the world, yeah the final version of visual studio 2010 is released.  visual studio 2010 is the next major  version of its predecessor with loads of new <a href="http://msdn.microsoft.com/en-us/library/bb386063%28VS.100%29.aspx" target="_blank">features</a>.</p>
<p>if you want to see the launch event of visual studio you can see it <a href="http://www.microsoft.com/visualstudio/en-us/watch-it-live" target="_blank">here</a>.</p>
<p><a href="http://weblogs.asp.net/scottgu">Scott Guthrie</a>, and other geeks from microsoft tweeted that visual studio will be available for download around 10 am (PST).  and the good news is its available for the <a href="http://www.microsoft.com/web/websitespark/" target="_blank">websitespark </a>subscribers too <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>here are some of those tweets for you :</p>
<blockquote><p>@<a rel="nofollow" href="http://twitter.com/shanselman">shanselman</a>:  Developers: MSDN will be updated with <a title="#vs2010" rel="nofollow" href="http://twitter.com/search?q=%23vs2010">#vs2010</a> downloads and  details at 10am PST *today*! Pls RT! <a rel="bookmark" href="http://twitter.com/Aneef/status/12035037152"></a></p></blockquote>
<blockquote><p><a href="http://twitter.com/scottgu" target="_blank">@scottgu</a>:MSDN Subscribers &amp; WebsiteSpark/BizSpark  members can download VS 2010 Monday morning.</p></blockquote>
<p>happy developing guys <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/04/12/visual-studio-2010-rtm-net-framework-4-0-final-version-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 RC Now Available for Download</title>
		<link>http://www.aneef.net/2010/02/10/visual-studio-2010-rc-now-available-for-download/</link>
		<comments>http://www.aneef.net/2010/02/10/visual-studio-2010-rc-now-available-for-download/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 22:55:53 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Scott Guthrie]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=127</guid>
		<description><![CDATA[Microsoft has just released the Release Candidate version of Visual Studio 2010 for public download. You can now download and try out Visual Studio 2010 RC and .NET Framework 4 RC before the final version which is due to hit retail in this first quarter of 2010. It was released for MSDN Subscribers on 8th [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Microsoft has just released the Release Candidate version of Visual Studio 2010 for public download. You can now download and try out Visual Studio 2010 RC and .NET Framework 4 RC before the final version which is due to hit retail in this first quarter of 2010. It was released for <a href="http://msdn.microsoft.com/">MSDN </a>Subscribers on 8th February and released for the public just few minutes ago (11th February 2010).</p>
<p><img class="alignnone" title="Visual studio 2010 RC" src="http://www.microsoft.com/visualstudio/en-us/content/images/msdn/placeholder_for_vid.jpg" alt="Visual studio 2010 RC" width="560" height="315" /></p>
<p>It is a much  awaited version of visual studio and it is available in following SKU&#8217;s:</p>
<ul>
<li>Visual Studio 2010 Ultimate</li>
<li>Visual Studio 2010 Premium</li>
<li>Visual Studio 2010 Professional</li>
</ul>
<p>Those who wish to try it, go get your copy <a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target="_blank">here</a>.</p>
<p>According to the reviews so far VS 2010 RC seems to be much faster in  Compiling, Building  and Intellisense. Read Scott Guthrie&#8217;s announcement on this release <a href="http://weblogs.asp.net/scottgu/archive/2010/02/08/vs-2010-net-4-release-candidate.aspx" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2010/02/10/visual-studio-2010-rc-now-available-for-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCRUM- Quick Guide</title>
		<link>http://www.aneef.net/2009/11/11/scrum-quick-guide/</link>
		<comments>http://www.aneef.net/2009/11/11/scrum-quick-guide/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 07:32:23 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[Methodologies]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SCRUM]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=111</guid>
		<description><![CDATA[I just thought to share this two videos i found in youtube, which is very useful for those who want to learn about SCRUM methodology, wikipedia: Scrum is an iterative incremental framework for managing complex work (such as new product development) commonly used with agile software development. for more info read here. SCRUM Basics by [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I just thought to share this two videos i found in youtube, which is very useful for those who want to learn about SCRUM methodology, <em>wikipedia: <strong>Scrum</strong> is an iterative incremental framework for managing complex work (such as new product development) commonly used with <a title="Agile software development" href="http://en.wikipedia.org/wiki/Agile_software_development">agile software development</a>. </em>for more info read <a href="http://en.wikipedia.org/wiki/Scrum_%28development%29" target="_blank">here</a>.<em> </em></p>
<p><strong>SCRUM Basics by Orjan Hillbom</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/vmGMpME_phg&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/vmGMpME_phg&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>SCRUM in Under 10 Minutes (HD) by @hamids</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="295" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Q5k7a9YEoUI&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="295" src="http://www.youtube.com/v/Q5k7a9YEoUI&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/11/11/scrum-quick-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FCKEDitor &#8211; FIXED Image Upload dialog hang for .net</title>
		<link>http://www.aneef.net/2009/09/25/fckeditor-fixed-image-upload-dialog-hang-for-net/</link>
		<comments>http://www.aneef.net/2009/09/25/fckeditor-fixed-image-upload-dialog-hang-for-net/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 11:22:53 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[CKEditor]]></category>
		<category><![CDATA[Continous]]></category>
		<category><![CDATA[FCK Editor]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Progress]]></category>
		<category><![CDATA[Upload]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=107</guid>
		<description><![CDATA[Well This issue has been bugging alot of people around the net it seems. I&#8217;m one of the victim too *sigh*.. anways bianchi007, a member in the CKSource Site forums had posted a solution. thought it would be worth to share. Here is the solution which was posted in this thread. This is for the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Well This issue has been bugging alot of people around the net it seems. I&#8217;m one of the victim too *sigh*.. anways <a href="http://cksource.com/forums/memberlist.php?mode=viewprofile&amp;u=12108">bianchi007,</a> a member in the <a href="http://cksource.com/Forums/">CKSource </a>Site forums had posted a solution. thought it would be worth to share.</p>
<p>Here is the solution which was posted in <a href="http://cksource.com/forums/viewtopic.php?f=6&amp;t=12112&amp;p=36585&amp;hilit=image+upload#p36585">this thread</a>.</p>
<p>This is for the .net assembly 2_6_3. I based it on the help file <a href="http://dev.fckeditor.net/attachment/ticket/2115/2115.patch">http://dev.fckeditor.net/attachment/tic &#8230; 2115.patch</a></p>
<p>Steps:</p>
<p>Open the FredCK.FCKeditorV2.vs2005.csproj in Visual Studio 2005</p>
<p>Open the file FileBrowser &gt; FileWorkerBase.cs</p>
<p>Go to line 119</p>
<p>Replace:<br />
[sourcecode language="csharp"]<br />
Response.Write( @&quot;(function(){var d=document.domain;while (true){try{var A=window.top.opener.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,&#8221;);if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();&quot; );<br />
[/sourcecode]</p>
<p>Replace with:<br />
[sourcecode language="csharp"]<br />
Response.Write(@&quot;(function(){var d=document.domain;while (true){try{var A=window.parent.OnUploadCompleted;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,&#8221;);if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();&quot;);<br />
[/sourcecode]<br />
Compile the project and then reference the new dll file in your project.</p>
<p>I hope it helps <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/09/25/fckeditor-fixed-image-upload-dialog-hang-for-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scott Guthrie Announces the WebsiteSpark Program</title>
		<link>http://www.aneef.net/2009/09/24/scott-guthrie-announces-the-websitespark-program/</link>
		<comments>http://www.aneef.net/2009/09/24/scott-guthrie-announces-the-websitespark-program/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 10:06:43 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[ScottGu]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[WebSpark]]></category>

		<guid isPermaLink="false">http://www.aneef.net/?p=104</guid>
		<description><![CDATA[Scott guthrie just did a great announcement about the WebsiteSpark Program. what is WebsiteSpark? WebsiteSpark is designed for independent web developers and web development companies that build web applications and web sites on behalf of others.  It enables you to get software, support and business resources from Microsoft at no cost for three years, and [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Scott guthrie just did a great announcement about the <a href="http://www.microsoft.com/web/websitespark/">WebsiteSpark </a>Program.</p>
<p><strong>what is WebsiteSpark?</strong></p>
<p><span style="font-family: arial; font-size: x-small;"><a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebsiteSpark</a> is designed for independent web developers and web development companies that build web applications and web sites on behalf of others.  It enables you to get software, support and business resources from Microsoft at no cost for three years, and enables you to expand your business and build great web solutions using ASP.NET, Silverlight, SharePoint and PHP, and the <a href="http://www.microsoft.com/web/gallery/default.aspx" target="_blank">open source applications</a> built on top of them.</p>
<h3><span style="text-decoration: underline;">What does the program provide?</span></h3>
<p><a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebSiteSpark</a> provides software licenses that you can use for three years at no cost.  Once enrolled, you can download and immediately use the following software from Microsoft:</p>
<ul>
<li>3 licenses of Visual Studio 2008 Professional Edition</li>
<li>1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)</li>
<li>2 licenses of Expression Web 3</li>
<li>4 processor licenses of Windows Web Server 2008 R2</li>
<li>4 processor licenses of SQL Server 2008 Web Edition</li>
<li>DotNetPanel control panel (enabling easy remote/hosted management of your servers)</li>
</ul>
<p>The Windows Server and SQL Server licenses can be used for both development <em>and</em> production deployment.  You can either self-host the servers on your own, or use the licenses with a hoster.  <a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebsiteSpark</a> makes it easy to find hosters who are also enrolled in the program, and who can use your licenses to provide you with either dedicated or virtual dedicated servers to host your sites on.</p>
<p>In addition to software, <a href="http://www.microsoft.com/web/websitespark/" target="_blank">WebsiteSpark</a> provides partner opportunities to grow and build your business (including customer referrals through our partner programs).  It also includes product support (including 2 professional support incidents) and free online training for the products.</p>
<p>for further information on this visit Scotts blog <a href="http://weblogs.asp.net/scottgu/archive/2009/09/24/announcing-the-websitespark-program.aspx">here.</a></p>
<p>Thanks Scott for the great information <img src='http://www.aneef.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/09/24/scott-guthrie-announces-the-websitespark-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClickOnce Application,Expired Certificates &amp; Public Key Token PART III &#8211; Pushing .net Framework 3.5</title>
		<link>http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/</link>
		<comments>http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:33:24 +0000</pubDate>
		<dc:creator>Aneef Fashir</dc:creator>
				<category><![CDATA[.Net Related]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[ClickOnce]]></category>
		<category><![CDATA[Tricks & Tips]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[.Net Installation.]]></category>
		<category><![CDATA[Certificate]]></category>
		<category><![CDATA[Check .Net Framework]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/</guid>
		<description><![CDATA[In the last few weeks I wrote 2 articles on how to resolve ClickOnce certificate expiration issues. you can find those articles here : ClickOnce Application,Expired Certificates &#38; Public Key Token PART I ClickOnce Application,Expired Certificates &#38; Public Key Token PART II During my work on this ClickOnce update, we decided to upgrade the application [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>In the last few weeks I wrote 2 articles on how to resolve ClickOnce certificate expiration issues. you can find those articles here :</p>
<ol>
<li><a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-i/">ClickOnce Application,Expired Certificates &amp; Public Key Token PART I</a>
<li><a href="http://www.aneef.net/2009/06/11/clickonce-applicationexpired-certificates-public-key-token-part-ii/">ClickOnce Application,Expired Certificates &amp; Public Key Token PART II</a> </li>
</ol>
<ol>During my work on this ClickOnce update, we decided to upgrade the application to target .net framework 3.5 sp1.</ol>
<ol>so I just set the target framework to 3.5 and set the required prerequisites (.net 3.5 SP1, and Windows Installer 3.1). and built the project and published it. and when I tried on a client machine which had .net framework 2.0, application got updated, prompted the uninstall message, and tried to launch the new ClickOnce application from the new URL, and BANG!. we get an error :</ol>
<ol><a href="http://www.aneef.net/wp-content/uploads/2009/07/image001.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image001" src="http://www.aneef.net/wp-content/uploads/2009/07/image001_thumb.jpg" width="286" height="142"></a></ol>
<ol>The Error Message Says :</ol>
<blockquote><p>Unable to install or run the application. The application</p>
<p>requires that assembly WindowsBase Version 3.0.0.0 be</p>
<p>installed in the Global Assembly Cache (GAC) first.</p>
</blockquote>
<p>Why is this ?, its because when we try to launch the new application URL we do this :</p>
<pre>DeploymentUtils.AutoInstall("&lt;Path toNewApplication.application&gt;");</pre>
<pre>&nbsp;</pre>
<p>we request for the application manifest. and it fails to launch the application because it doesn&#8217;t have the prerequisites. and now to force the new prerequisites the application should call the setup.exe in the Web Server instead of the manifest. now the question is, what if the user already have&nbsp; the .net Framework 3.5 SP1?, we don&#8217;t have to prompt the client to install them again by launching setup.exe, we just have to launch the manifest. To Serve both the above scenario we need to check if the client machine has .net framework 3.5 SP1, and depending on its availability we need to launch the manifest or the setup.exe. The existence of .net Framework can be obtained from the following registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP <a href="http://www.aneef.net/wp-content/uploads/2009/07/image.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://www.aneef.net/wp-content/uploads/2009/07/image_thumb.png" width="544" height="216"></a> you can find out all the .net Frameworks installed and their service pack versions in this registry entry. Following are the locations of the main Net Frameworks:</p>
<table border="0" cellspacing="0" cellpadding="2" width="540">
<tbody>
<tr>
<td valign="top" width="128">Framework 1.1</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v1.1.4322</td>
</tr>
<tr>
<td valign="top" width="128">Framework 2.0</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727</td>
</tr>
<tr>
<td valign="top" width="128">Framework 3.0</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v3.0\\Setup</td>
</tr>
<tr>
<td valign="top" width="128">Framework 3.5</td>
<td valign="top" width="411">Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Now we can check if the required .net Framework is available in the client machine, and launch the application setup.exe or the manifest. to do this we need to programmatically check these registries. for this I used the attached code ( I Couldn&#8217;t find the original author, Credits goes to him/her) which I found from web and modified to avoid few bugs. you can add this code to your project and do the below check in your application to decide which file to be launched :</p>
<pre class="csharpcode">&nbsp;</pre>
<pre class="csharpcode"><span class="kwrd">string</span> FileToLaunch=<span class="str">@"/setup.exe"</span>;
<span class="kwrd">if</span> (FrameworkUtils.IsInstalled(FrameworkVersion.Fx35)

 &amp;&amp; FrameworkUtils.GetServicePackLevel(FrameworkVersion.Fx35) == 1)
          {
            FileToLaunch = <span class="str">@"/&lt;application manifest.application&gt;"</span>;
          }
            MessageBox.Show(<span class="str">"Your message here"</span>);
            <span class="kwrd">string</span> updateURL = DeploymentUtils.getUpdateURL();
            DeploymentUtils.UninstallMe();
            DeploymentUtils.AutoInstall(<span class="str">"https://"</span> + updateURL + FileToLaunch);
            Application.Exit();</pre>
<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>
<pre class="csharpcode">&nbsp;</pre>
<p>And that&#8217;s all, now the application will launch the setup.exe if the client doesn&#8217;t have the .net Framework 3.5 and prompt for its installation, or launch the application manifest if client has the framework installed.</p>
<p>Now you can solve your ClickOnce issue as well as upgrade .net Framework in client machine at the same time without problem.</p>
<p><a href="wp-content/uploads/2009/07/FrameworkUtil.cs.txt">Download FrameworkUtils.cs</a></p>
<p><!-- .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; } --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aneef.net/2009/07/09/clickonce-applicationexpired-certificates-public-key-token-part-iii-pushing-net-framework-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.aneef.net @ 2012-02-04 22:28:04 by W3 Total Cache -->
