<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>My.Ramblings</title><link>http://blogs.msdn.com/b/pranav_rastogi/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>My favorite tools and software</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2013/03/02/my-favorite-developer-tools-of-2013.aspx</link><pubDate>Sun, 03 Mar 2013 02:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10398853</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10398853</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2013/03/02/my-favorite-developer-tools-of-2013.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size: medium;"&gt;Every handy man has their own set of recommended tools which makes them extremely productive. Other these years I have developed a liking for a few of them which I would like to share with you. I hope you will like them as well and some of them do increase your productivity.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: medium;"&gt;I do plan to regularly update this post and add more tools/software as I find more useful ones.&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: medium;"&gt;&lt;a href="http://office.microsoft.com/en-us/onenote/"&gt;http://office.microsoft.com/en-us/onenote/&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: medium;"&gt;&lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;http://www.microsoft.com/web/downloads/platform.aspx&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: medium;"&gt;&lt;a href="http://windows.microsoft.com/en-US/windows7/products/features/snipping-tool"&gt;http://windows.microsoft.com/en-US/windows7/products/features/snipping-tool&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: medium;"&gt;&lt;a href="http://www.microsoft.com/en-us/server-cloud/windows-server/server-virtualization.aspx"&gt;http://www.microsoft.com/en-us/server-cloud/windows-server/server-virtualization.aspx&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10398853" width="1" height="1"&gt;</description></item><item><title>Modern ASP.NET WebForms 4.5–DevIntersection 2012</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/12/10/modern-asp-net-webforms-4-5-devintersections-2012.aspx</link><pubDate>Mon, 10 Dec 2012 23:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10376202</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10376202</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/12/10/modern-asp-net-webforms-4-5-devintersections-2012.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size: small;"&gt;Thank you all who came for my talk on ASP.NET WebForms 4.5 at DevIntersection(&lt;a href="http://devintersection.com/"&gt;http://devintersection.com/&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Please find the slides and the samples as follows&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Slides&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;iframe style="border-width: 1px 1px 0px; border-style: solid; border-color: #cccccc; margin-bottom: 5px;" src="http://www.slideshare.net/slideshow/embed_code/15578805" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="427" height="356"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;div style="margin-bottom: 5px;"&gt;&lt;strong&gt;&lt;a title="Web forms- DevIntersection" href="http://www.slideshare.net/rustd/web-forms-devintersection" target="_blank"&gt;Web forms- DevIntersection&lt;/a&gt; &lt;/strong&gt; from &lt;strong&gt;&lt;a href="http://www.slideshare.net/rustd" target="_blank"&gt;rustd&lt;/a&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Samples&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;iframe src="https://skydrive.live.com/embed?cid=43459A6389A804D9&amp;amp;resid=43459A6389A804D9%212205&amp;amp;authkey=AO-gZ2qc0P5XzfE" frameborder="0" scrolling="no" width="98" height="120"&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;I have also included my talk walkthrough so you can relate to all the concepts I talked about&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Talk Walkthrough&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;- Outline &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Not the usual flow of features but some interesting things you can do with the webforms framework &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Pattern based development &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Cleaner code &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Extensibility&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; - Templates rendering &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Standards compliant&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; - OAuth/Open Id Login &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Uncomment AuthConfig &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Login using Google&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; - Web Optimization &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Debug=true(all files) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Debug=false(bundled files) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Framework scripts &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Bundled as nuget packages &lt;br /&gt; - Tips &amp;amp; tricks &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Script Manager &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --- Remappings &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Originally come from aspnet ajaxcdn but you can change it &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- CDN support(enable cdn=true) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Even the bundles &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- LoadSuccessExpression &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- If the network goes out then you can load the scripts locally&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; - Patterns/Tips &amp;amp; Tricks &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Model Binding &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Basics &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Model Binding &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Routing &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- PRG &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Repository &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Unit Testability &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Dynamic data &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Model Binding Extensibility &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ------&amp;nbsp; Aggregate Value Providers and an attribute &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Similar to mvc &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----- AdHoc Model Binding &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No data controls &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Anonymous types cannot be constructed&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Control Builder Interceptor &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Customize the compilation system &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Change what kind of code gets generated &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Great of custom control developers &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Edit the codedom of the existing control - not possible before &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Sub class the control &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Reimplement the control builder &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- To use this put it in the config &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Layer of indirection between UI/code something like MVP. Little code talking to UI &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Layer of indirection between code and markup &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Take this idea further along &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Advanced control builder interceptor &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Earlier written using custom controls but with the new feature in v4.5 you can do it more easily&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Command Bubbling &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- WPF/Silverlight &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Rather than event handlers to do business logic - command interface &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Remove as much code as I can &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Code interacts with controls - separation of concerns &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Declarative statements to wire up server controls to data &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Imperative logic factored out into different classes &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Webforms has bubbling event(&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt; Controls like gridview work like this) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Separation of concern/Clean code behind &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Event bubbling to update UI when an event happens(click/button) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Component driven/event driven &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;--&lt;span style="font-size: x-small;"&gt;&amp;nbsp; Tag Mapping &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Code to modify control&amp;hellip;do not put it in the code behind &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Remapping controls &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Custom Templates &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- User voice item &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Load them from database/file etc&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp; -- Imperative vs declarative &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Declarative - more maintainable - you know everything statically &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Imperative - set stuff dynamically &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt; - Async Support &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Async=false &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Async=true &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; --Async/await usage &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- FriendlyURLs &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Cleaner Urls which are easy to use &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Show the async demo on a mobile device &lt;/p&gt;
&lt;p&gt;- Scaffolding &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Person class &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Scaffold using UI &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- CRUD on desktop &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Default on mobile &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10376202" width="1" height="1"&gt;</description></item><item><title>Model Binding Fundamentals</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/11/30/model-binding-fundamentals.aspx</link><pubDate>Fri, 30 Nov 2012 09:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10373413</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10373413</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/11/30/model-binding-fundamentals.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size: x-small;"&gt;In the previous &lt;/span&gt;&lt;a href="http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/22/asp-net-webforms-model-binding-overview.aspx" target="_blank"&gt;post&lt;/a&gt;&lt;span style="font-size: x-small;"&gt; we looked at an overview of what is Model Binding and the benefits it brings in for WebForms developers. In this post we will look at the basic fundamentals and how the Model Binding system works with controls.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-size: small;"&gt;Data Binding with Model Binding&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Uptil ASP.NET v4.0, data binding in controls happened with data bound controls such as GridView used to bound to data source controls such as ObjectDataSource. We will use this as a reference to understand the flow in the Model Binding System. A lot of the implementation derives inspiration from ObjectDataSource.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Following snippet shows how a GridView calls the Model Binding system to get a list of products.&lt;/span&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt; &amp;lt;asp:GridView ID=&lt;span class="str"&gt;"getProduct"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; ItemType=&lt;span class="str"&gt;"Products"&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;            UpdateMethod=&lt;span class="str"&gt;"getProduct_UpdateItem"&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;             SelectMethod=&lt;span class="str"&gt;"getProduct_GetData"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; IQueryable&amp;lt;Products&amp;gt; getProduct_GetData()&lt;/pre&gt;
&lt;pre class="alt"&gt;        {&lt;/pre&gt;
&lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; _context.Products.ToList();&lt;/pre&gt;
&lt;pre class="alt"&gt;        }&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;// The id parameter name should match the DataKeyNames value set on the control&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; getProduct_UpdateItem(&lt;span class="kwrd"&gt;int&lt;/span&gt; id)&lt;/pre&gt;
&lt;pre class="alt"&gt;        {&lt;/pre&gt;
&lt;pre&gt;            Products item = &lt;span class="kwrd"&gt;null&lt;/span&gt;;            &lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;            TryUpdateModel(item);&lt;/pre&gt;
&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (ModelState.IsValid)&lt;/pre&gt;
&lt;pre&gt;            {&lt;/pre&gt;
&lt;pre class="alt"&gt;                &lt;span class="rem"&gt;// Save changes here, e.g. MyDataLayer.SaveChanges();&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;            }&lt;/pre&gt;
&lt;pre&gt;        }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;At the heart of the Model Binding system is a datasource called &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.modeldatasource.aspx" target="_blank"&gt;&lt;span style="font-size: x-small;"&gt;ModelDataSource&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt;. and &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.modeldatasourceview.aspx" target="_blank"&gt;&lt;span style="font-size: x-small;"&gt;ModelDataSourceView&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt; As a developer when you never Bind the GridView to the ModelDataSource. The DataSource is an implementation detail which takes in value from the control and passes onto the ModelBinding system to perform the Binding &amp;amp; Validation to the model and gives the result back to the control/page.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-size: small;"&gt;Page Execution Flow&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Now that we know that there is a datasource involved at the implementation level of the ModelBinding system, let&amp;rsquo;s look at the flow from the control &amp;ndash; ModelBinding &amp;ndash; control. At a very high level this is what happens&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;GridView calls the SelectMethod to get the values&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;This initializes the ModelDataSource and it calls the ExecuteSelect method on ModelDataSourceView&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;The ModelDataSourceView calls the DefaultModelBinder&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;DefaultModelBinder looks through all the ModelBinderProviders registered in the system and tried to get the ModelBinder that can provide the value for a given Type&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;The selected ModelBinder gets called to perform the Binding of values to the Model&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;The ModelBinder calls the ValueProvider to get the value.&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;This is useful if you want to specify that the value is coming from a control/querystring or other collections&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;I wanted to put this information out now so that you can get an idea about the plugability areas that exist in the ModelBinding system. In the later posts w We are going to look more into the details&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-size: small;"&gt;Model Binders and Model Binder Providers&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The initialization of the ModelBindig system registers the following ModelBinders. These&amp;nbsp; partition the responsibilities of the original DefaultModelBinder, making it easy to consume them from your own custom binder or to replace their individual responsibilities. For example, changing how dictionaries are bound application-wide now involves replacing a single provider rather than rewriting the DefaultModelBinder. The binders included in-box are, in order:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;TypeMatchModelBinderProvider&lt;/strong&gt; &amp;ndash; If the incoming value is already typed correctly for the target model (e.g. incoming value is string, property to bind is string), short-circuits the entire process and just returns the string.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;BinaryDataModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles binding base-64 encoded input to byte[] and System.Linq.Data.Binary models. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;KeyValuePairModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles KeyValuePair&amp;lt;TKey, TValue&amp;gt;. Consumed by the dictionary binder.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;ComplexModelDtoModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles complex models. Consumed by the mutable object binder. More info on this type in the tutorial at the end of this document.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;ArrayModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles T[].&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;DictionaryModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles IDictionary&amp;lt;TKey, TValue&amp;gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;CollectionModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles IEnumerable&amp;lt;T&amp;gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;middot; &lt;strong&gt;TypeConverterModelBinderProvider&lt;/strong&gt; &amp;ndash; Handles simple type conversions, e.g. incoming value is a string and property to bind is an integer.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-size: small;"&gt;Value Providers&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Following are the Value providers which you can use to specify where should the ModelBinding look for when trying to get the value&lt;/span&gt;&lt;/p&gt;
&lt;table border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Value Providers&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: x-small;"&gt;Description&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Form&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the Form collection&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Control&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the specified control&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;QueryString&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the QueryString collection&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Cookie&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the Cookie collection&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Profile&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the Profile collection&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;RouteData&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the Route collection&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="198"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Session&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="341"&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The value is retrieved from the Session collection&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;In the next few posts we will look at how to do basic create/replace/delete/filtering cases and then look at extending the ModelBinding system using these concepts&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Hope you will find this useful!!!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;This has been cross posted to &lt;a href="http://blogs.msdn.com/b/webdev/archive/2012/11/30/model-binding-fundamentals.aspx"&gt;http://blogs.msdn.com/b/webdev/archive/2012/11/30/model-binding-fundamentals.aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10373413" width="1" height="1"&gt;</description></item><item><title>Interacting with Databases for Web Developers in VS 2012</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/11/12/interacting-with-databases-for-web-developers-in-vs-2012.aspx</link><pubDate>Mon, 12 Nov 2012 16:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10367766</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10367766</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/11/12/interacting-with-databases-for-web-developers-in-vs-2012.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size: x-small;"&gt;VS2012 is out and with it brings a host of developer improvements when dealing with data. This post aims at highlighting a few key improvements which will affect you the most and hopefully you will find this information useful in getting started with the improvements in Visual Studio tooling to interact with databases. While the Data Tooling itself has undergone a lot of changes, this post is geared towards Web Application Developers.&lt;/span&gt;&lt;/p&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;Changes in VS2012&lt;/span&gt;&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;VS2012 ships with &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc645993.aspx"&gt;&lt;span style="font-size: x-small;"&gt;SQL2012&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt; engine.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;VS2012 ships with an enchanced Sql tools(SSDT) which brings in functionality from SSMS(SqlServerManagementStudio) to VS &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;As part of this integration, you will see a new window called &amp;ldquo;SQL Server Object Browser&amp;rdquo;. In this window you can do advanced Database management stuff, such as running sprocs, managing Initial Catalogs etc. which were not possible in &amp;ldquo;Database Explorer&amp;rdquo;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Some &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/data/hh297028"&gt;&lt;span style="font-size: x-small;"&gt;videos&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt; to learn more about SSDT.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;"Sql Server Express" is no longer installed with VS. Instead VS ships with "Sql Server Express LocalDB". &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;LocalDB development is supported in VS2012 for .NET v4.0/v4.5 on Windows 8/ Windows 7 &amp;ndash; Client and Server SKUs&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;LocalDB development is supported in VS2012 for .NET v3.5 on Windows 8 only(Client and Server SKUs)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Enhanced User experience while upgrading projects from VS2010 to VS2012 &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;This user experience has some guidance which help you upgrade databases which were using SQLExpress to LocalDB&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Auto loading of ConnectionStrings in ServerExplorer &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;if we detect that your ConnectionString points to a database which exists, then we load the connectionstring in the ServerExplorer so its there when you want to use it. This is an improvement from Dev10 where you had to explicitly add the ConnectionString&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;Why LocalDB?&lt;/span&gt;&lt;/h5&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The quick pitch for LocalDB is the following: &amp;ldquo;It is very easy to install and it requires no management&amp;rdquo; LocalDB runs as your account and not as a system wide service(which is how SqlExpress runs). This &lt;/span&gt;&lt;a href="http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx"&gt;&lt;span style="font-size: x-small;"&gt;post&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt; from the SQL team goes in detail about the benefits&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;With all the changes of moving away from SqlExpress to LocalDB, nothing should change in terms of your application development. You should be able to use&amp;nbsp; almost the same connectionStrings as you had with SqlExpress, but instead change the DataSource from &amp;ldquo;.\SQLExpress&amp;rdquo; to &amp;ldquo;(LocalDb)\v11.0&amp;rdquo; and remove the UserInstance flag since LocalDb always runs as your account&lt;/span&gt;&lt;/p&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;Initial Catalog vs AttachDbFileName&lt;/span&gt;&lt;/h5&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;If you look at the connectionstring, the templates for ASP.NET WebForms, MVC use in VS 2012, you will notice that the connectionstring looks like follows. This connection is somewhat different to what you might have seen with web projects in VS2010 where we were only using AttachDbFileName.This change has nothing to do with LocalDb, on the contrary this exposes some of the common patterns that have existed when working with SQL.&lt;/span&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;p&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="DefaultConnection"&lt;/span&gt; &lt;span class="attr"&gt;connectionString&lt;/span&gt;&lt;span class="kwrd"&gt;="Data Source=(LocalDb)\v11.0;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="kwrd"&gt;Initial Catalog=aspnet-MvcApplication18-20121022222325;Integrated Security=SSPI;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="kwrd"&gt;AttachDBFilename=|DataDirectory|\aspnet-MvcApplication18-20121022222325.mdf"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="attr"&gt;providerName&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Data.SqlClient"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Following is how these two values are used&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;Initial Catalog&lt;/strong&gt;: This entry is a key in the SQL master table which holds all of the databases which were created on an instance. In this case the instance is &amp;ldquo;(LocalDb)\v11.0&amp;rdquo;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;AttachDbFileName&lt;/strong&gt;: This entry tells SQL the location of the mdf file which holds the database information.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;The SQL engine uses Initial Catalog to look up the database entry in its master list and load the database file from the path specified by AttachDbFileName&lt;/span&gt;&lt;/p&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;One small caveat&lt;/span&gt;&lt;/h5&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;By surfacing this information to the developer, a developer can run into the following situation. Let&amp;rsquo;s say that you ran your application and created a database with the above connectionstring. In this case, if you delete the database file(mdf) from disk and do not change the connectionstring, then SQL will look up the database by the Initial Catalog entry which still exists and will try to load the database from disk based on the AttachDbFileName and since the database does not exist, you will get the following error.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;em&gt;&amp;ldquo;Cannot attach the file 'c:\users\foo\documents\visual studio 2012\Projects\MvcApplication18\MvcApplication18\App_Data\aspnet-MvcApplication18-20121022222325.mdf' as database 'aspnet-MvcApplication18-20121022222325'.&lt;/em&gt;&amp;rdquo;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;To workaround this error do either of the following&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Change the Initial Catalog and AttachDbFileName value to be something unique&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Using SSDT, connect to &amp;ldquo;(LocalDb)\v11.0&amp;rdquo; instance and delete the Initial Catalog entry specified in the database&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The reason the AttachDbFileName entry exists so that the database file gets dropped in App_Data folder of your application.&lt;/p&gt;
&lt;h5&gt;&amp;nbsp;&lt;/h5&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;How to Videos for basic operations in VS tooling&lt;/span&gt;&lt;/h5&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:37a993cf-e3ff-4b44-9dc5-c88f31ca91b9" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;
&lt;div&gt;&lt;object width="448" height="252"&gt;&lt;param name="movie" value="http://www.youtube.com/v/52meUYO0-5g?hl=en&amp;amp;hd=1" /&gt;&lt;/object&gt;&lt;/div&gt;
&lt;div style="width: 448px; clear: both; font-size: .8em;"&gt;Working with Entity Framework Code First&lt;/div&gt;
&lt;/div&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;Cheat sheet of things to remember/do for Data in VS2012&lt;/span&gt;&lt;/h5&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;These cheat sheet is useful when you are trying to figure out what instance to use for LocalDB&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Default Instance of Localdb in VS2012 is "(LocalDb)\v11.0" &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;This means whenever you are connecting to a localdb instance you need to type in the above to connect to using Windows Authentication to operate on your database&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Tools-Options is "(LocalDb)\v11.0" &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;This means that any local database that you create will be created using "(LocalDb)\v11.0" instance&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;If you have SqlExpress installed and you want to use SqlExpress as the default local database server you should change this option in VS. This is a global setting for VS&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;LocalDB does not run with UserInstance=true setting &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;You will get an error when you run your application&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;&lt;span style="font-size: x-small;"&gt;Helpful links/scripts&lt;/span&gt;&amp;nbsp;&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/pranav_rastogi/archive/2012/02/20/mapping-sql-mdf-file-versions-to-sql-product-versions.aspx"&gt;&lt;span style="font-size: x-small;"&gt;Figuring out the version of your database file&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/23/common-commands-to-manage-a-sql-instance.aspx"&gt;&lt;span style="font-size: x-small;"&gt;Common commands to manage a SQL instance&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;I hope this would help you understand the changes in the Data Tooling experience for VS2012. This was cross posted at&amp;nbsp;http://blogs.msdn.com/b/webdev/archive/2012/11/12/interacting-with-databases-for-web-developers-in-vs-2012.aspx&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10367766" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/VS/">VS</category></item><item><title>Building Modern WebForms - DevConnections 2012</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/30/modern-webforms-devconnections-2012.aspx</link><pubDate>Tue, 30 Oct 2012 22:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10364270</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10364270</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/30/modern-webforms-devconnections-2012.aspx#comments</comments><description>&lt;p&gt;Thank you all for coming for my talk on Building Modern WebForms application. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You can download the samples from&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;iframe height="120" src="https://skydrive.live.com/embed?cid=43459A6389A804D9&amp;amp;resid=43459A6389A804D9%212205&amp;amp;authkey=AO-gZ2qc0P5XzfE" frameborder="0" width="98" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;p&gt; The slide deck is as follows&lt;/p&gt; &lt;iframe style="border-width: 1px 1px 0px; border-style: solid; border-color: rgb(204, 204, 204); margin-bottom: 5px;" height="356" marginheight="0" src="http://www.slideshare.net/slideshow/embed_code/14957264" frameborder="0" width="427" marginwidth="0" scrolling="no" allowfullscreen="allowfullscreen"&gt;&lt;/iframe&gt;   &lt;div style="margin-bottom: 5px;"&gt;&lt;strong&gt;&lt;a title="Web forms" href="http://www.slideshare.net/rustd/web-forms-14957264" target="_blank"&gt;Web forms&lt;/a&gt; &lt;/strong&gt;from &lt;strong&gt;&lt;a href="http://www.slideshare.net/rustd" target="_blank"&gt;rustd&lt;/a&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10364270" width="1" height="1"&gt;</description></item><item><title>ASP.NET Web Forms Application (2012) Templates on Visual Studio 2010</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/29/asp-net-web-forms-application-2012-templates-on-visual-studio-2010.aspx</link><pubDate>Mon, 29 Oct 2012 08:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10363562</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10363562</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/29/asp-net-web-forms-application-2012-templates-on-visual-studio-2010.aspx#comments</comments><description>&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;The release of Visual Studio 2012 included updated templates for ASP.NET WebForms, MVC and WebPages. The templates showcased the use of modern standards in HTML5, CSS and JavaScript. Apart from these, they also showcased social login via Twitter, Facebook etc.&amp;nbsp; Scott Hanselman has a short video demonstrating &lt;/span&gt;&lt;a href="http://www.asp.net/vnext/overview/videos/oauth-in-the-default-aspnet-45-templates" target="_blank"&gt;&lt;span size="2" style="font-size: x-small;"&gt;social login&lt;/span&gt;&lt;/a&gt;&lt;span size="2" style="font-size: x-small;"&gt;. While this amazing goodness was available for developers who had access to VS2012. If you were a Web Forms developer using VS2010SP1, then there was no way for you install these templates. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;To solve this problem, I created a Visual Studio Extension which will install the templates that we shipped with VS2012.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span style="background-color: #ffff00;"&gt;Note&lt;/span&gt;: &lt;/strong&gt;This Extension is by no means supported by Microsoft. It is something I created in my own spare time to make it easier for WebForms developers using VS2010SP1 to use the updated templates that we shipped with VS2012&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Download and Use the Extension&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;If you are using VS2010SP1, then you can do the following else you can download the extension(&lt;a href="http://visualstudiogallery.msdn.microsoft.com/ec79e369-51bd-4212-83d0-71349d038461" target="_blank"&gt;ASPNETWebForms&lt;/a&gt;) from the VS Gallery&lt;/li&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Open VS2010SP1&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Click Tools &amp;ndash; Extension Manager&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Goto Online Gallery and search for &amp;ldquo;aspnet webforms&amp;rdquo;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Alternately, you can search for the name of the extensions &amp;ldquo;&lt;strong&gt;ASPNETWebForms&lt;/strong&gt;&amp;rdquo;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Once you have searched for the extension, it will appear as follows in the search result&lt;/span&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/6765.extensionsearch_5F00_4C4E3478.png"&gt;&lt;img title="extensionsearch" style="display: inline; background-image: none;" border="0" alt="extensionsearch" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1050.extensionsearch_5F00_thumb_5F00_6F2EF628.png" width="564" height="312" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Download the extension/ The templates will show up in the File-New project dialog in the following category(Visual C#&amp;ndash; Web)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;To use the installed templates, create the project in &amp;ldquo;File &amp;ndash; New Project &amp;ndash; Visual C#-Web &amp;ndash; ASPNETWebFormsApplication&amp;rdquo;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/2642.extension_5F00_installed_5F00_4311F937.png"&gt;&lt;img title="extension_installed" style="display: inline; background-image: none;" border="0" alt="extension_installed" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/6765.extension_5F00_installed_5F00_thumb_5F00_3B1A56D5.png" width="555" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span size="2" style="font-size: x-small;"&gt;Once the project is created, follow the instructions in the readme.txt file to Build &amp;amp; Run the project&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://visualstudiogallery.msdn.microsoft.com/ec79e369-51bd-4212-83d0-71349d038461"&gt;&lt;span size="2" style="font-size: x-small;"&gt;http://visualstudiogallery.msdn.microsoft.com/ec79e369-51bd-4212-83d0-71349d038461&lt;/span&gt;&lt;/a&gt;&lt;span size="2" style="font-size: x-small;"&gt; has more details about the Extension and also what SKUs are supported.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;Please do give feedback on the &lt;a href="http://visualstudiogallery.msdn.microsoft.com/ec79e369-51bd-4212-83d0-71349d038461" target="_blank"&gt;VS Gallery&lt;/a&gt; for the extension.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;This post has been cross posted at&amp;nbsp;&lt;a href="http://blogs.msdn.com/b/webdev/archive/2012/10/29/asp-net-web-forms-application-2012-templates-on-visual-studio-2010.aspx"&gt;http://blogs.msdn.com/b/webdev/archive/2012/10/29/asp-net-web-forms-application-2012-templates-on-visual-studio-2010.aspx&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span size="2" style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10363562" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Asp-Net/">Asp.Net</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/templates/">templates</category></item><item><title>Common commands to manage a Sql Instance</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/23/common-commands-to-manage-a-sql-instance.aspx</link><pubDate>Tue, 23 Oct 2012 07:32:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10361966</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10361966</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/23/common-commands-to-manage-a-sql-instance.aspx#comments</comments><description>&lt;p&gt;This post is a repository of commands that I have been commonly using to manage a Sql Instance.&lt;/p&gt;  &lt;h3&gt;List the sys admins on a instance&lt;/h3&gt;  &lt;p&gt;select [name] from sys.syslogins where sysadmin=1&lt;/p&gt;  &lt;h3&gt;Add yourself/someone as a sysadmin on sql instance&lt;/h3&gt;  &lt;p&gt;EXEC master..sp_addsrvrolemember @loginame = N'redmond\pranavra', @rolename = N'sysadmin'&lt;/p&gt;  &lt;p&gt;EXEC master..sp_addsrvrolemember @loginame = N'BUILTIN\Administrators', @rolename = N'sysadmin'&lt;/p&gt;  &lt;p&gt;EXEC master..sp_addsrvrolemember @loginame = N'REDMOND\aapfte', @rolename = N'sysadmin'&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Remove yourself/someone as a sysadmin on sql instance&lt;/h3&gt;  &lt;p&gt;EXEC sp_droprolemember 'sysadmin', 'redmond\pranavra'&lt;/p&gt;  &lt;h3&gt;Running these commands if you do not have VS Pro and cannot connect to TSqlEditor&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Open an admin prompt &lt;/li&gt;    &lt;li&gt;Goto SQLInstall\Microsoft SQL Server\MSSQL.X\MSSQL\Binn eg D:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn&lt;/li&gt;    &lt;li&gt;sqlcmd -SComputerName\InstanceName Eg Sqlcmd -S .\SQLEXPRESS&lt;/li&gt;    &lt;li&gt;Execute the command as you need eg     &lt;ul&gt;       &lt;li&gt;select [name] from sys.syslogins where sysadmin=1&lt;/li&gt;        &lt;li&gt;Go&lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Changing compatibility version of sqldatabase&lt;/h3&gt;  &lt;p&gt;EXEC sp_dbcmptlevel 'aspnet-WebApplication3-20120502172054', 90 &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10361966" width="1" height="1"&gt;</description></item><item><title>ASP.NET WebForms Model Binding – Overview</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/22/asp-net-webforms-model-binding-overview.aspx</link><pubDate>Tue, 23 Oct 2012 06:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10361939</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10361939</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/10/22/asp-net-webforms-model-binding-overview.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size: x-small;"&gt;This is the first post in the part of series around Model Binding. In this post I will introduce Model Binding integration in ASP.NET WebForms while focusing on history, benefits, principles and the integration of Model Binding. In the upcoming posts, I will be going into the details about the features that are supported by this system.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;What is Model Binding&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Model Binding is a system which binds a value submitted from the client to a model on the server so that the model is available for inspection for validation rules and processing on the server. In essence the system has two fundamental functions &amp;ndash; Binding &amp;amp; Validation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;In a WebForms application, data binding(from client to server and vice versa) typically happens via Data Bound and Data Source controls. While this approach has the advantages of an experience where you can get your application up and running easily, it does have some drawbacks for some developers who want to tap in more modern ways of developing applications, such as : doing validation using Data Annotations, &lt;a name="PRG"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;PRG pattern, Repository patters, cleaner page code behind etc.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;History Behind Model Binding&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Model Binding as a system has existed in many Frameworks. Rails implements the core functions of Binding &amp;amp; Validation in its own way. ASP.NET MVC had Model binding support since its early stages. When ASP.NET MVC2 was released, the team released a prototype of an &amp;ldquo;&lt;/span&gt;&lt;a href="http://aspnet.codeplex.com/downloads/get/110748" target="_blank"&gt;&lt;span style="font-size: x-small;"&gt;Extensible Model Binding system&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt;&amp;rdquo;. This prototype made it possible for a&amp;nbsp; Framework developer to write their own Model Binding system, should they choose to do so.(of course anyone in their right minds would not attempt it, but the ASP.NET team decided anyways to do this for WebForms)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Infact this Extensible Model Binding was how the team derived lots of inspiration from while trying to implement a Model Binding System that integrates the flexibility of Model Binding system and power of controls. ASP.NET WebAPI also derives some inspiration from this extensible model when ASP.NET WebAPI added support for binding using different formatters.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Benefits of Model Binding&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;With the introduction of Model Binding, it is now much easier to build modern webforms applications. Following are the areas where this integration adds value&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Rich controls support&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;All the existing data bound controls such as GridView, ListView etc have been updated to work with Model Binding so you should be able to reuse the rich functionality of these controls&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Validation&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Modern ways of validation using Data Annotation attributes&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Easier to propagate validation errors from Business Layer back to the UI on the page&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Easier to integrate model level validation errors(from ORM such as EF or anything of your choice) when saving the record in the database&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Dynamic Data support&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Easier to add validation via Data Annotations and client side validation&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Easier to customize the UI for columns using Data Annotations and Field Templates&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Add rich UI for integrating jquery based DateTime picker for DateTime fields&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Easier to customize the entities using Data Annotations and Entity Templates&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Easier to embrace the following patterns&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Unit Testing the application layer&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Post/Redirect/Get" target="_blank"&gt;&lt;span style="font-size: x-small;"&gt;PRG pattern&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Repository pattern&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Cleaner page code behind methods. These server side code files do not have any application functional code and they only focus on UI interactions&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Extensible Model Binding system&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Support scenarios of binding in advanced scenarios such as complex types, ad-hoc Model Binding&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Customize the existing implementation to enable more commonly used scenarios easier such as Master Details view&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Add more Binders and Value providers&lt;/span&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;I hope so far this would help you understand the bigger picture with WebForms Model Binding and value it brings to an application developer. As Scott Hanselman &lt;/span&gt;&lt;a href="http://www.hanselman.com/blog/OneASPNETSneakPeekElegantWebFormsAndSnowballsInHell.aspx" target="_blank"&gt;&lt;span style="font-size: x-small;"&gt;noted&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: x-small;"&gt;, this integration also brings ASP.NET MVC/WebForms application development much closer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;In the next post we will be looking at some high level fundamentals and features on Model Binding in WebForms&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Cross posted to http://blogs.msdn.com/b/webdev/archive/2012/11/15/asp-net-webforms-model-binding-overview.aspx&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10361939" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Asp-Net/">Asp.Net</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Model+Binding/">Model Binding</category></item><item><title>ASP.NET 4.5 ScriptManager Improvements in WebForms</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/21/asp-net-4-5-scriptmanager-improvements-in-webforms.aspx</link><pubDate>Fri, 21 Sep 2012 09:07:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10351860</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10351860</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/21/asp-net-4-5-scriptmanager-improvements-in-webforms.aspx#comments</comments><description>&lt;p&gt;The ScriptManger control has undergone some key targeted changes in ASP.NET 4.5 which makes it easier to register, manage and combine scripts using the ASP.NET &lt;a href="http://aspnetoptimization.codeplex.com/" target="_blank"&gt;weboptimization&lt;/a&gt; feature. This post will highlight the changes that have happened to this control&lt;/p&gt;  &lt;h2&gt;Easy Integration with JQuery and JQueryUI&lt;/h2&gt;  &lt;p&gt;The &lt;a href="https://github.com/rustd/ASPNETTemplates" target="_blank"&gt;default templates&lt;/a&gt; for WebForms ship with the following packages “&lt;strong&gt;&lt;a href="http://nuget.org/packages/AspNet.ScriptManager.jQuery" target="_blank"&gt;AspNet.ScriptManager.jQuery&lt;/a&gt;&lt;/strong&gt;” and “&lt;strong&gt;&lt;a href="http://nuget.org/packages/AspNet.ScriptManager.jQuery.UI.Combined" target="_blank"&gt;AspNet.ScriptManager.jQuery.UI.Combined&lt;/a&gt;&lt;/strong&gt;”. These packages make it easier to bring in jquery and jqueryUI libraries&amp;#160; and also register them with the ScriptManager. Here is how it works.&lt;/p&gt;  &lt;p&gt;These packages add the following &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.scriptresourcemapping.aspx" target="_blank"&gt;ScriptMappings&lt;/a&gt; for jquery and jqueryUI in the &lt;a href="http://haacked.com/archive/2010/05/16/three-hidden-extensibility-gems-in-asp-net-4.aspx" target="_blank"&gt;PreApplicationStart&lt;/a&gt; method of the application&lt;/p&gt;  &lt;h3&gt;JQuery&lt;/h3&gt;  &lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;   &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;     &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; str = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;1.7.1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    ScriptManager.ScriptResourceMapping.AddDefinition(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;jquery&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptResourceDefinition&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        Path = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/jquery-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.min.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        DebugPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/jquery-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/jQuery/jquery-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.min.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        CdnDebugPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/jQuery/jquery-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnSupportsSecureConnection = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        LoadSuccessExpression = &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;quot;window.jQuery&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    });&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;JQuery.UI&lt;/h3&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; str = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;1.8.20&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    ScriptManager.ScriptResourceMapping.AddDefinition(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;jquery.ui.combined&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptResourceDefinition&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        Path = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/jquery-ui-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.min.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        DebugPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/jquery-ui-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/jquery.ui/&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;/jquery-ui.min.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        CdnDebugPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/jquery.ui/&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;/jquery-ui.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnSupportsSecureConnection = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    });&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;These SciptMappings are registered with ScriptManager as follows&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;asp:ScriptManager runat=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &amp;lt;Scripts&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;jquery&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;jquery.ui.combined&amp;quot;&lt;/span&gt; /&amp;gt;            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &amp;lt;/Scripts&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &amp;lt;/asp:ScriptManager&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Now you can enjoy all the benefits of having ScriptManager such as&lt;/p&gt;

&lt;h3&gt;Debug/Release Support&lt;/h3&gt;

&lt;p&gt;If you are debugging your application(debug=true) in web.config then ScriptManager will serve the scripts from debug path(non minified scripts) such as “~/Scripts/jquery-1.7.1.js”&lt;/p&gt;

&lt;h3&gt;CDN Support&lt;/h3&gt;

&lt;p&gt;If your set EnableCDN=true on the ScriptManager control, then all the Scripts will be served from the CDN path such as “&lt;a href="http://ajax.aspnetcdn.com/ajax/jquery-1.7.1.js"&gt;http://ajax.aspnetcdn.com/ajax/jquery-1.7.1.js&lt;/a&gt;”&lt;/p&gt;

&lt;h3&gt;Override Script Mappings&lt;/h3&gt;

&lt;p&gt;Let’s assume that you wanted to override the scriptmappings to change the CDN path where these scripts are served from. You can do so by changing the scriptmapping before the page is accessed. Typically doing this in Global.asax is better&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; str = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;1.7.1&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    ScriptManager.ScriptResourceMapping.AddDefinition(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;jquery&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptResourceDefinition&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        Path = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/jquery-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.min.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        DebugPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/jquery-&amp;quot;&lt;/span&gt; + str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://http://code.jquery.com/jquery-&amp;quot;&lt;/span&gt;+ str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.min.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        CdnDebugPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://code.jquery.com/jquery-&amp;quot;&lt;/span&gt;+ str + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnSupportsSecureConnection = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    });&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Updating Jquery/JqueryUI libraries&lt;/h3&gt;

&lt;p&gt;Let’s say a new version of Jquery or JqueryUI comes along. Traditionally you would have to download the jquery packages for these libraries and then update the script references everywhere on your pages. With the above integration of AspNet.ScriptManager.Jquery packges this scenario really becomes easy since when you update Jquery/JqueryUI you will get corresponding versions of AspNet.ScriptManager.Jquery/AspNet.ScriptManager.Jquery.UI which will update the scriptmappings to the current version of jquery that was downloaded and you do not have to change anything in your application&lt;/p&gt;

&lt;h2&gt;LoadSuccessExpression&lt;/h2&gt;

&lt;p&gt;This is a new property which is added to the ScriptMapping and it takes care of the following use case. Imagine that you are serving your scripts from a CDN path and if there is an outage in the CDN, your site will be affected because you will not be able to serve any scripts. This property takes in an expression which evaluates whether the script was loaded correctly and if it fails then it renders the script from the local application path. &lt;/p&gt;

&lt;p&gt;Following is how the script tag looks like for jquery(assuming that you are serving scripts from CDN)&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;script src=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.1.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;lt;script type=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&amp;lt;![CDATA[&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;(window.jQuery)||document.write(&lt;span style="color: rgb(0, 96, 128);"&gt;'&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;Scripts/jquery-1.8.1.js&amp;quot;&amp;gt;&amp;lt;\/script&amp;gt;'&lt;/span&gt;);&lt;span style="color: rgb(0, 128, 0);"&gt;//]]&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Remapping Framework scripts&lt;/h2&gt;

&lt;p&gt;One neat improvement that happened in ASP.NET 4.5 is the decoupling of the “Microsoft Ajax script files(MicrosoftAjaxCore etc)” and the WebForms scripts(GridView.js etc). We did the work in this release so you can serve these scripts from your application Scripts folder rather than load then up from System.Web This makes the scripts easily redistributable and updateable. The following section explains on how you can use these scripts and combine them with WebOptimization feature&lt;/p&gt;

&lt;h3&gt;Serving Framework Scripts from inside the application&lt;/h3&gt;

&lt;p&gt;We created the following 2 packages “&lt;a href="nuget.org/packages/Microsoft.AspNet.ScriptManager.MSAjax" target="_blank"&gt;Microsoft.AspNet.ScriptManager.MSAjax&lt;/a&gt;” “&lt;a href="nuget.org/packages/Microsoft.AspNet.ScriptManager.WebForms" target="_blank"&gt;Microsoft.AspNet.ScriptManager.WebForms&lt;/a&gt;” which do the following&lt;/p&gt;

&lt;p&gt;Install the Scripts into your application so it looks like follows&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1832.fxscripts_5F00_0D3AE7EC.png"&gt;&lt;img title="fxscripts" style="display: inline; background-image: none;" border="0" alt="fxscripts" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/8875.fxscripts_5F00_thumb_5F00_66009EB6.png" width="318" height="414" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These packages also create the following scriptmappings so that they can be registered with ScriptManager as follows&lt;/p&gt;

&lt;h3&gt;MicrosoftAjax scripts&lt;/h3&gt;

&lt;p&gt;We are registering all the scripts and we are bundling them together as “MsAjaxBundle”&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;ScriptManager.ScriptResourceMapping.AddDefinition(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MsAjaxBundle&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptResourceDefinition&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        Path = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/bundles/MsAjaxJs&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/4.5/6/MsAjaxBundle.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        LoadSuccessExpression = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnSupportsSecureConnection = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjax.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys._Application &amp;amp;&amp;amp; Sys.Observer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxCore.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Type &amp;amp;&amp;amp; Sys.Observer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxGlobalization.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.CultureInfo&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxSerialization.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.Serialization&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxComponentModel.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.CommandEventArgs&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxNetwork.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.Net &amp;amp;&amp;amp; Sys.Net.WebRequestExecutor&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxHistory.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.HistoryEventArgs&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxWebServices.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.Net &amp;amp;&amp;amp; Sys.Net.WebServiceProxy&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxTimer.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.UI &amp;amp;&amp;amp; Sys.UI._Timer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxWebForms.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.WebForms&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    PreApplicationStartCode.AddMsAjaxMapping(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MicrosoftAjaxApplicationServices.js&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.Sys &amp;amp;&amp;amp; Sys.Services&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Here is the Bundle definition for these scripts&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;bundles.Add(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptBundle(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/bundles/MsAjaxJs&amp;quot;&lt;/span&gt;).Include(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/MsAjax/MicrosoftAjax.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Here is the ScriptManger registration for these scripts&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;asp:ScriptManager runat=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; &amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &amp;lt;Scripts&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;%--Framework Scripts--%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MsAjaxBundle&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;%--Site Scripts--%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &amp;lt;/Scripts&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &amp;lt;/asp:ScriptManager&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;WebForms scripts&lt;/h3&gt;

&lt;p&gt;We are registering all the scripts and we are bundling them together as “WebFormsBundle”&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;ScriptManager.ScriptResourceMapping.AddDefinition(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;WebFormsBundle&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptResourceDefinition&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        Path = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/bundles/WebFormsJs&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnPath = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http://ajax.aspnetcdn.com/ajax/4.5/6/WebFormsBundle.js&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        LoadSuccessExpression = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;window.WebForm_PostBackOptions&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        CdnSupportsSecureConnection = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    });&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Bundle Definition&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;bundles.Add(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ScriptBundle(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/bundles/WebFormsJs&amp;quot;&lt;/span&gt;).Include(&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/WebForms.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/WebUIValidation.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/MenuStandards.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/Focus.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/GridView.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/DetailsView.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/TreeView.js&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                  &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/WebParts.js&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;ScriptManager registration&lt;/h3&gt;

&lt;p&gt;The reason we have the Assembly and the Path attribute here is because ScriptManager special cases these scripts when it tries to load them, so we had to make some special arrangements with ScriptManager code to make this work &lt;img class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/7128.wlEmoticon_2D00_smile_5F00_178C0C4C.png" /&gt; This is a process which is called deduping. Basically when the ScriptManager tried to load up these scripts, it can load them up from System.Web or the path attribute and eventually in this case, the ScriptManager dedupes the script references and serves the scripts from the path attribute. This is part of the “special arrangement” that we did in ScriptManager. We were very cautious when doing this given this code path was on a very critical path for mainline ScriptManager scenarios which we did not want to regress.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;asp:ScriptManager runat=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; &amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &amp;lt;Scripts&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;%--Framework Scripts--%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;WebForms.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/WebForms.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;WebUIValidation.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/WebUIValidation.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;MenuStandards.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/MenuStandards.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;GridView.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/GridView.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;DetailsView.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/DetailsView.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;TreeView.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/TreeView.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;WebParts.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/WebParts.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Focus.js&amp;quot;&lt;/span&gt; Assembly=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt; Path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;~/Scripts/WebForms/Focus.js&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &amp;lt;asp:ScriptReference Name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;WebFormsBundle&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &amp;lt;%--Site Scripts--%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &amp;lt;/Scripts&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &amp;lt;/asp:ScriptManager&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;When you run this page you will get script references as follows&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;
  &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;script src=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;/bundles/MsAjaxJs?v=J4joXQqg80Lks57qbGfUAfRLic3bXKGafmR6wE4CFtc1&amp;quot;&lt;/span&gt; type=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;lt;script src=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;/bundles/WebFormsJs?v=q9E9g87bUDaS624mcBuZsBaM8xn2E5zd-f4FCdIk2cA1&amp;quot;&lt;/span&gt; type=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &amp;lt;script type=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;So these were the improvements that happened in the ScriptManager control for registering scripts. In case you want to refresh your memory, &lt;a href="http://weblogs.asp.net/infinitiesloop/archive/2009/11/23/asp-net-4-0-scriptmanager-improvements.aspx" target="_blank"&gt;ScriptManager&lt;/a&gt; was greatly enhanced in ASP.NET v4.0 and Dave Reed had a fantastic post about it, which I strongly recommend to go through.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10351860" width="1" height="1"&gt;</description></item><item><title>Configuring your ASP.NET application for Microsoft OAuth account</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/19/configuring-your-asp-net-application-for-microsoft-oauth-account.aspx</link><pubDate>Wed, 19 Sep 2012 07:29:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10350719</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10350719</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/19/configuring-your-asp-net-application-for-microsoft-oauth-account.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3"&gt;This post is a part of the &lt;a href="http://blogs.msdn.com/b/webdev/archive/2012/08/15/oauth-openid-support-for-webforms-mvc-and-webpages.aspx" target="_blank"&gt;series&lt;/a&gt; about how to enable and use OpenID/OAuth support that was added to the ASP.NET templates in Visual Studio 2012. In this post I am going to detail the instructions on configuring your application to use Microsoft account for authentication. I am going to be focusing on configuring the application for a development environment(using VS &amp;amp; IISExpress)&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt; Create a new ASP.NET MVC/WebForms or WebPages application &lt;/font&gt;&lt;/strong&gt;&amp;#160;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3"&gt;Build and run the website.&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3"&gt;&lt;strong&gt;Use a test domain&lt;/strong&gt;&lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3"&gt;You need to use a domain other than localhost since Microsoft account cannot redirect back to localhost&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3"&gt;Some folks have graciously reserved &lt;/font&gt;&lt;a href="http://readme.localtest.me/"&gt;&lt;font size="3"&gt;localtest.me&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; for local testing of domains so you do not have to mess with hosts files. Follow the link for more information&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3"&gt;You can use Foo.localtest.me as a test domain. (Make sure Foo is unique. I would recommend prefixing it with something unique such as Foo&amp;lt;MyName&amp;gt;.localtest.me ). For the purpose of this article we will use Foo.localtest.me&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3"&gt;Ping Foo.localtest.me should be reverted back to local machine&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;Edit firewall rules for port 80 to receive external requests.&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3"&gt;Follow the guidelines as mentioned (These work for windows8 as well)&lt;/font&gt;&lt;a href="http://maximumpcguides.com/windows-7/open-a-port-in-windows-7s-firewall/"&gt;&lt;font size="3"&gt;http://maximumpcguides.com/windows-7/open-a-port-in-windows-7s-firewall/&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;Configuring the Microsoft live portal&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3"&gt;Open link &lt;/font&gt;&lt;a href="https://manage.dev.live.com/AddApplication.aspx"&gt;&lt;font size="3"&gt;https://manage.dev.live.com/AddApplication.aspx&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;. Login using live credentials &lt;/font&gt;&lt;/li&gt;     &lt;font size="3"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="3"&gt;Enter Application name and click on I accept (Read the terms of use and privacy if it concerns you !)&lt;/font&gt;&lt;/li&gt;     &lt;font size="3"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="3"&gt;In the Live Connect Developer Center where the APP was created in step 7, click on Application Settings page link -&amp;gt; API settings&lt;/font&gt;&lt;/li&gt;     &lt;font size="3"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="3"&gt;In the redirectDomain enter the above created domain name. Eg: &lt;/font&gt;&lt;a href="http://Foo.localtest.me"&gt;&lt;font size="3"&gt;http://Foo.localtest.me&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;     &lt;font size="3"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="3"&gt;Hit Save and the changes should be saved&lt;!--EndFragment--&gt;&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;Configuring the keys in your application&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3"&gt;For MVC/WebForms applications&lt;/font&gt;&lt;/li&gt;      &lt;ul&gt;       &lt;li&gt;&lt;font size="3"&gt;Edit&amp;#160; the AuthConfig file in the App_Start folder and uncomment the code for the Microsoft OAuth provider. Copy the client ID and client secret in the AuthConfig file in the uncommented section of Microsoft login&lt;/font&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;!--StartFragment--&gt;&lt;font size="3"&gt;&lt;/font&gt;      &lt;li&gt;&lt;font size="3"&gt;For WebPages applications&lt;/font&gt;&lt;/li&gt;     &lt;font size="3"&gt;&lt;/font&gt;      &lt;ul&gt;&lt;font size="3"&gt;&lt;/font&gt;        &lt;li&gt;&lt;font size="3"&gt;Edit&amp;#160; the&amp;#160; _AppStart.cshtml file and uncomment the code for the Microsoft OAuth provider. Copy the client ID and client secret to this file in the uncommented section of Microsoft login&lt;/font&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;Map the test domain to your application&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3"&gt;Now we need to add mapping for the domain name to be redirected to our application created in step 1&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;For IIS Express&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;      &lt;ul&gt;       &lt;li&gt;&lt;font size="3"&gt;Open applicationHost.config in %Documents%\IISExpress\config &lt;/font&gt;&lt;/li&gt;        &lt;li&gt;&lt;font size="3"&gt;Locate the binding for the web application in the file. It will be defined in the &amp;lt;site&amp;gt; tag. For example&lt;/font&gt;&lt;/li&gt;        &lt;ul&gt;         &lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);"&gt;           &lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;             &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;site name=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;WebApplication5&amp;quot;&lt;/span&gt; id=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;6&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;lt;application path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;/&amp;quot;&lt;/span&gt; applicationPool=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Clr4IntegratedAppPool&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;virtualDirectory path=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;/&amp;quot;&lt;/span&gt; physicalPath=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;pathtoapplication\WebApplication5&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;lt;/application&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;bindings&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;lt;binding protocol=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;http&amp;quot;&lt;/span&gt; bindingInformation=&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;*:46178:localhost&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;/bindings&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

            &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;lt;/site&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/ul&gt;

      &lt;li&gt;&lt;font size="3"&gt;Add a new binding for port 80 and the domain name to this web application under the &amp;lt;bindings&amp;gt;&lt;/font&gt;&lt;/li&gt;
      &lt;font size="3"&gt;&lt;/font&gt;

      &lt;li&gt;&lt;font size="3"&gt;&amp;lt;binding protocol=&amp;quot;http&amp;quot; bindingInformation=&amp;quot;*:80:Foo.localtest.me &amp;quot; /&amp;gt;&lt;/font&gt;&lt;/li&gt;
      &lt;font size="3"&gt;&lt;/font&gt;

      &lt;li&gt;&lt;font size="3"&gt;Restart IIS Express and relaunch the website. Test the above setting made by opening in the browser Foo.localtest.me. It should open the web application created.&lt;/font&gt;&lt;/li&gt;
    &lt;/ul&gt;

    &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;IIS (7.0) upwards&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;font size="3"&gt;Host you application in IIS&lt;/font&gt;&lt;/li&gt;

      &lt;li&gt;&lt;font size="3"&gt;Open up IIS Manager locate your web application under the Sites list and select &amp;quot;Bindings&amp;quot; from the action menu on the right. Add a binding for your chosen hostname (e.g. Foo.localtest.me ).&lt;/font&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
&lt;/ul&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;&lt;font size="3"&gt;Run the site to see it in action&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;&lt;font size="3"&gt;Make sure you are running VS as an admin for this to work&lt;/font&gt;&lt;/li&gt;

    &lt;li&gt;&lt;font size="3"&gt;Now launch the application either hosted in IIS Express or IIS&lt;/font&gt;&lt;/li&gt;

    &lt;li&gt;&lt;font size="3"&gt;Browse to the test domain Foo.localtest.me&lt;/font&gt;&lt;/li&gt;

    &lt;li&gt;&lt;font size="3"&gt;Navigate to Login page and login using Microsoft Live credentials. Login should be successful&lt;/font&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="3"&gt;Hope you have fun while integrating Microsoft Account into your applications&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10350719" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Asp-Net/">Asp.Net</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/oauth/">oauth</category></item><item><title>Integrate OpenAuth/OpenID with your existing ASP.NET application using Universal Providers</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/12/integrate-openauth-openid-with-your-existing-asp-net-application-using-universal-providers.aspx</link><pubDate>Wed, 12 Sep 2012 08:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10348593</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10348593</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/12/integrate-openauth-openid-with-your-existing-asp-net-application-using-universal-providers.aspx#comments</comments><description>&lt;p&gt;Over the past couple of weeks I have come across lots of questions/discussions on while OAuth/OpenId is cool as a feature in the ASP.NET templates in Visual Studio 2012, but how do I easily integrate this into my application outside of the templates. More so how do I extend the Universal Providers to integrate OAuth/OpenId and use other functionality such as roles etc. I am going to cover these two areas in this post using WebForms but you could integrate the same with MVC applications as well&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #00ff00;"&gt;Update&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;While the post is titled to show how you can integrate this with UniversalProviders, you can totally integrate this with SqlMembership or with your custom membership providers since&amp;nbsp;Microsoft.AspNet.Membership.OpenAuth uses Membership APIs for creating users and login&lt;/p&gt;
&lt;p&gt;I posted the following webforms project template which uses sqlmembership&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/rustd/AspNetSocialLoginSqlMembership"&gt;https://github.com/rustd/AspNetSocialLoginSqlMembership&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Following are the steps of integrating OpenAuth/OpenId into your existing application&lt;/h3&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;I started with an empty 4.5 webapplication(yes nothing in my project except a web.config)&lt;/li&gt;
&lt;li&gt;Use Nuget to get the following packages&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;DotNetOpenAuth.AspNet&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;This package is the core package for OAuth/OpenID protocol communication&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Microsoft.AspNet.Providers.Core&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;This package brings in Universal Providers&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Microsoft.AspNet.Providers.LocalDb&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;This package sets the connectionstring for the Universal Providers&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Microsoft.AspNet.Membership.OpenAuth&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;This package provides the extension to integrate OAuth/OpenID with Universal Providers&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;li&gt;Change web.config to use formsauthentication&lt;/li&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;authentication&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;mode&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="Forms"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;     &lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;forms&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;loginUrl&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="Default.aspx"&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;forms&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;authentication&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;In App_Start Register the list of OAuth/OpenId providers you want to use. By convention any application_start registration is done in a folder called App_Start&lt;/li&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #008000;"&gt;// See http://go.microsoft.com/fwlink/?LinkId=252803 for details on setting up this ASP.NET&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;// application to support logging in via external services.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;//OpenAuth.AuthenticationClients.AddTwitter(&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: #008000;"&gt;// consumerKey: "your Twitter consumer key",&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;// consumerSecret: "your Twitter consumer secret");&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;//OpenAuth.AuthenticationClients.AddFacebook(&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: #008000;"&gt;// appId: "your Facebook app id",&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;// appSecret: "your Facebook app secret");&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;//OpenAuth.AuthenticationClients.AddMicrosoft(&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: #008000;"&gt;// clientId: "your Microsoft account client id",&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            &lt;span style="color: #008000;"&gt;// clientSecret: "your Microsoft account client secret");&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            OpenAuth.AuthenticationClients.AddGoogle();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Create a page to display the list of providers to use for logging in(This page reads the list configured in App_Start) In my sample I created Default.aspx.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Markup&lt;/li&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;lt;asp:ListView runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; ID=&lt;span style="color: #006080;"&gt;"providerDetails"&lt;/span&gt; ItemType=&lt;span style="color: #006080;"&gt;"Microsoft.AspNet.Membership.OpenAuth.ProviderDetails"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;             SelectMethod=&lt;span style="color: #006080;"&gt;"GetProviderNames"&lt;/span&gt; ViewStateMode=&lt;span style="color: #006080;"&gt;"Disabled"&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;             &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                 &amp;lt;button type=&lt;span style="color: #006080;"&gt;"submit"&lt;/span&gt; name=&lt;span style="color: #006080;"&gt;"provider"&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;value&lt;/span&gt;=&lt;span style="color: #006080;"&gt;"&amp;lt;%#: Item.ProviderName %&amp;gt;"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                     title=&lt;span style="color: #006080;"&gt;"Log in using your &amp;lt;%#: Item.ProviderDisplayName %&amp;gt; account."&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                     &amp;lt;%#: Item.ProviderDisplayName %&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                 &amp;lt;/button&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;             &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;             &amp;lt;EmptyDataTemplate&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                 &amp;lt;p&amp;gt;There are no external authentication services configured. &amp;lt;/p&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;             &amp;lt;/EmptyDataTemplate&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;         &amp;lt;/asp:ListView&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;li&gt;Code&lt;/li&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; IEnumerable&amp;lt;ProviderDetails&amp;gt; GetProviderNames()&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;         &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; OpenAuth.AuthenticationClients.GetAll();&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;At this stage the UI will look as follows&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1616.providers_5F00_6EDCF758.jpg"&gt;&lt;img title="providers" style="display: inline; background-image: none;" border="0" alt="providers" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/8540.providers_5F00_thumb_5F00_5508C129.jpg" width="572" height="179" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Request a call to the OpenID/OAuth provider for RequestAuthentication. This code will make an outbound call to the provider where a user can enter the login details and the provider will call back to the app&amp;rsquo;s return url&lt;/li&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; ReturnUrl { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: #0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: #0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (IsPostBack)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var provider = Request.Form[&lt;span style="color: #006080;"&gt;"provider"&lt;/span&gt;];&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (provider == &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                    &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var redirectUrl = &lt;span style="color: #006080;"&gt;"~/ExternalLoginLandingPage.aspx"&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(ReturnUrl))&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                    var resolvedReturnUrl = ResolveUrl(ReturnUrl);&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                    redirectUrl += &lt;span style="color: #006080;"&gt;"?ReturnUrl="&lt;/span&gt; + HttpUtility.UrlEncode(resolvedReturnUrl);&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                OpenAuth.RequestAuthentication(provider, redirectUrl);&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;At this stage the UI will look as follows&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1307.googlelogin_5F00_33A91B8D.png"&gt;&lt;img title="googlelogin" style="display: inline; background-image: none;" border="0" alt="googlelogin" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1200.googlelogin_5F00_thumb_5F00_52EBC260.png" width="437" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Now when the provider calls back to the app, we have to check whether the user was authenticated without any errors and if so then login the user. In my sample user I configured the returnurl to be ExternalLoginLandingPage.aspx so create a page called ExternalLoginLandingPage in the root of your app. This page serves the following functions(For brevity, I am pasting in relevant methods/markup here. This entire sample is posted on my github repository &lt;a href="https://github.com/rustd/SocialLoginASPNET"&gt;https://github.com/rustd/SocialLoginASPNET&lt;/a&gt;)&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Display the authenticated username from the provider and verify if the authentication from provider succeeded or not(eg. did you enter correct username/password)&lt;/li&gt;
&lt;ol&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;ProcessProviderResult() &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; page_load does &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt; processing&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;ul&gt;&lt;ol&gt;&lt;ol&gt;&lt;/ol&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/8737.localaccount_5F00_18FC7F74.png"&gt;&lt;img title="localaccount" style="display: inline; background-image: none;" border="0" alt="localaccount" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1307.localaccount_5F00_thumb_5F00_234DA3D4.png" width="527" height="141" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;You can set the local username of the user if you want to and create the membership user and associate the OAuth/OpenID and save this to the database&lt;/li&gt;
&lt;ol&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/ul&gt;
&lt;/ul&gt;
&lt;div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;"&gt;
&lt;div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: #008000;"&gt;//Markup and refer to codebeind methods&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;&amp;lt;ol&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;               &amp;lt;li &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt;=&lt;span style="color: #006080;"&gt;"email"&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                   &amp;lt;asp:Label ID=&lt;span style="color: #006080;"&gt;"Label1"&lt;/span&gt; runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; AssociatedControlID=&lt;span style="color: #006080;"&gt;"userName"&lt;/span&gt;&amp;gt;User name&amp;lt;/asp:Label&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                   &amp;lt;asp:TextBox runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; ID=&lt;span style="color: #006080;"&gt;"userName"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                   &amp;lt;asp:RequiredFieldValidator ID=&lt;span style="color: #006080;"&gt;"RequiredFieldValidator1"&lt;/span&gt; runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; ControlToValidate=&lt;span style="color: #006080;"&gt;"userName"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                       Display=&lt;span style="color: #006080;"&gt;"Dynamic"&lt;/span&gt; ErrorMessage=&lt;span style="color: #006080;"&gt;"User name is required"&lt;/span&gt; ValidationGroup=&lt;span style="color: #006080;"&gt;"NewUser"&lt;/span&gt; /&amp;gt;                    &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;                   &amp;lt;asp:ModelErrorMessage ID=&lt;span style="color: #006080;"&gt;"ModelErrorMessage2"&lt;/span&gt; runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; ModelStateKey=&lt;span style="color: #006080;"&gt;"UserName"&lt;/span&gt; CssClass=&lt;span style="color: #006080;"&gt;"field-validation-error"&lt;/span&gt; /&amp;gt;                    &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;               &amp;lt;/li&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;           &amp;lt;/ol&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;           &amp;lt;asp:Button ID=&lt;span style="color: #006080;"&gt;"Button1"&lt;/span&gt; runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; Text=&lt;span style="color: #006080;"&gt;"Log in"&lt;/span&gt; ValidationGroup=&lt;span style="color: #006080;"&gt;"NewUser"&lt;/span&gt; OnClick=&lt;span style="color: #006080;"&gt;"logIn_Click"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"&gt;           &amp;lt;asp:Button ID=&lt;span style="color: #006080;"&gt;"Button2"&lt;/span&gt; runat=&lt;span style="color: #006080;"&gt;"server"&lt;/span&gt; Text=&lt;span style="color: #006080;"&gt;"Cancel"&lt;/span&gt; CausesValidation=&lt;span style="color: #006080;"&gt;"false"&lt;/span&gt; OnClick=&lt;span style="color: #006080;"&gt;"cancel_Click"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;At this stage the UI will look as follows&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/7266.loggedin_5F00_1E6AF018.png"&gt;&lt;img title="loggedin" style="display: inline; background-image: none;" border="0" alt="loggedin" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/6406.loggedin_5F00_thumb_5F00_4943542A.png" width="466" height="146" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Database structure&lt;/h2&gt;
&lt;p&gt;Once the membership user is saved to the database, the database will have the following tables&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1200.listoftables_5F00_28BC1478.png"&gt;&lt;img title="listoftables" style="display: inline; background-image: none;" border="0" alt="listoftables" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/0333.listoftables_5F00_thumb_5F00_16734DB6.png" width="206" height="167" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All tables would seem familiar as they are used by Universal Providers for membership, roles, profile. The 2 new tables were created by Microsoft.AspNet.Membership.OpenAuth to integrate OAuth/OpenId information with membership system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UsersOpenAuthAccounts&lt;/strong&gt;: This holds the information on what providers can the user login by.eg if your app is configured to use Facebook, Google then the user can login via either of them and this information will be stored here&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UsersOpenAuthData&lt;/strong&gt;: This table integrates the OAuth/Openid login to the membership system.&lt;/p&gt;
&lt;p&gt;Following image shows how OAuth/OpenId login information is wired to membership system.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/3343.usersdata_5F00_55D10146.png"&gt;&lt;img title="usersdata" style="display: inline; background-image: none;" border="0" alt="usersdata" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/8737.usersdata_5F00_thumb_5F00_6741621E.png" width="612" height="389" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The membershipusername is the username in the Users table.At this stage since you have the users table populated you can create roles and add/remove these users from roles and thus achieve OAuth/OpenId integration with Roles as well&lt;/p&gt;
&lt;p&gt;This entire sample is posted on my github repository(&lt;a href="https://github.com/rustd/SocialLoginASPNET"&gt;https://github.com/rustd/SocialLoginASPNET&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Feel free to download it and give it a try&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;What the default templates demonstrate more than this&lt;/h3&gt;
&lt;p&gt;To view the default templates incase you do not have VS 2012, you can browse them at the following github repro &lt;a href="https://github.com/rustd/ASPNETTemplates"&gt;https://github.com/rustd/ASPNETTemplates&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to protect against XSRF attacks&lt;/li&gt;
&lt;li&gt;Associate a local username/password with OAuth/OpenID account&lt;/li&gt;
&lt;li&gt;Register with more than one OpenID/OAuth provider&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I hope this would help in integration OAuth/OpenId easily into your application when you are not starting with the templates&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10348593" width="1" height="1"&gt;</description></item><item><title>Customizing the login UI when using OAuth/OpenID</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/24/customizing-the-login-ui-when-using-oauth-openid.aspx</link><pubDate>Fri, 24 Aug 2012 23:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10343419</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10343419</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/24/customizing-the-login-ui-when-using-oauth-openid.aspx#comments</comments><description>&lt;p&gt;&lt;span style="background-color: #99cc00;"&gt;&amp;nbsp;Update 1/11/2013: Fixing the code for webforms&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In the &lt;a href="http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/23/plugging-custom-oauth-openid-providers.aspx" target="_blank"&gt;last post&lt;/a&gt; I showed how you can plug in your own OAuth/OpenID provider. This post shows you how you can pass in extra data about the provider such as display name, image etc and use this information when building up the UI for login screen&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you see the experience of login screen in the ASP.NET templates, it looks like this.&lt;/p&gt;
&lt;div id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:65ed6666-f1fa-4a9f-9780-b0407b507602" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;&lt;a title="" href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/0880.oauthbutton_2D00_8x6_5F00_7DC3044E.png" rel="thumbnail"&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/1460.oauthbutton_5F00_24911A8F.png" alt="" width="335" height="144" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Let&amp;rsquo;s see how can we customize this UI to look like the following&lt;/p&gt;
&lt;div id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:75bd7eab-fae1-4617-ac40-b37930747ab2" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;&lt;a title="" href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/4812.oauthicons_2D00_8x6_5F00_5688BB19.png" rel="thumbnail"&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/3326.oauthicons_5F00_366DAE5C.png" alt="" width="335" height="145" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;Web Forms&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Pass in extra data in App_Start\AuthConfig.cs when registering the provider as follows&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;OpenAuth.AuthenticationClients.AddFacebook(&lt;/pre&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;                appId: &lt;span class="str"&gt;"your Facebook app id"&lt;/span&gt;,&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;                appSecret: &lt;span class="str"&gt;"your Facebook app secret"&lt;/span&gt;,&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extraData: &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;{ Icon = &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: x-small;"&gt;"~/Images/facebook.png"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;                );&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;&amp;nbsp;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div class="csharpcode"&gt;Access this data in the View(in the WebForms Internet template case it is Account\OpenAuthProviders.ascx&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="csharpcode"&gt;&amp;lt;img src=&lt;span class="str"&gt;"&amp;lt;%# Item.ExtraData["&lt;/span&gt;Icon&lt;span class="str"&gt;"] %&amp;gt;"&lt;/span&gt; alt=&lt;span class="str"&gt;"Alternate Text"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;MVC&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Pass in extra data in App_Start\AuthConfig.cs when registering the provider as follows&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; FacebooksocialData = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;();&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;            FacebooksocialData.Add(&lt;span class="str"&gt;"Icon"&lt;/span&gt;, &lt;span class="str"&gt;"~/Images/facebook.png"&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;            OAuthWebSecurity.RegisterFacebookClient(&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;                appId: &lt;span class="str"&gt;"someid"&lt;/span&gt;,&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;                appSecret: &lt;span class="str"&gt;"somesecret"&lt;/span&gt;,&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;                displayName: &lt;span class="str"&gt;"Facebook"&lt;/span&gt;,&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;                extraData: FacebooksocialData);&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div class="csharpcode"&gt;Access this data in the View(in the MVC Internet template case it is Views\Account\_ExternalLoginsListPartial&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt; @&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (AuthenticationClientData p &lt;span class="kwrd"&gt;in&lt;/span&gt; Model)&lt;/pre&gt;
&lt;pre&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;            &amp;lt;img src=&lt;span class="str"&gt;"@p.ExtraData["&lt;/span&gt;Icon&lt;span class="str"&gt;"]"&lt;/span&gt; alt=&lt;span class="str"&gt;"Icon for @p.DisplayName"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;pre&gt;           }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;WebPages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In _AppStart.cshtml&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; FacebooksocialData = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;();&lt;/pre&gt;
&lt;pre&gt;            FacebooksocialData.Add(&lt;span class="str"&gt;"Icon"&lt;/span&gt;, &lt;span class="str"&gt;"~/Images/facebook.png"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;            OAuthWebSecurity.RegisterFacebookClient(&lt;/pre&gt;
&lt;pre&gt;                appId: &lt;span class="str"&gt;"empty"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;                appSecret: &lt;span class="str"&gt;"empty"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;                displayName: &lt;span class="str"&gt;"Facebook"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;                extraData: FacebooksocialData);&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Access this data in the View(in the webpages template case it is Account\_ExternalLoginsListPartial&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt; @&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (AuthenticationClientData p &lt;span class="kwrd"&gt;in&lt;/span&gt; Model)&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;        {&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;            &amp;lt;img src=&lt;span class="str"&gt;"@p.ExtraData["&lt;/span&gt;Icon&lt;span class="str"&gt;"]"&lt;/span&gt; alt=&lt;span class="str"&gt;"Icon for @p.DisplayName"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;           }&lt;/pre&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10343419" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/openid/">openid</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/oauth/">oauth</category></item><item><title>Plugging custom OAuth/OpenID providers</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/23/plugging-custom-oauth-openid-providers.aspx</link><pubDate>Thu, 23 Aug 2012 15:25:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10342789</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10342789</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/23/plugging-custom-oauth-openid-providers.aspx#comments</comments><description>&lt;p&gt;In the &lt;a href="http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/22/extra-information-from-oauth-openid-provider.aspx" target="_blank"&gt;previous post&lt;/a&gt;, I wrote about how you can use the existing providers for Google, Facebook etc. and retrieve extra metadata about the authenticated users. Let’s assume you wanted to change the way the providers request for information. Some examples of this could be&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;You want to request more data about the user&lt;/li&gt;    &lt;li&gt;You want to apply different scope levels when requesting the data&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This post covers how you can write your own provider and plug it into your ASP.NET web application&lt;/p&gt;  &lt;h2&gt;Write your own provider&lt;/h2&gt;  &lt;p&gt;Each Provider implements from OpenIdClient. Following example shows a custom implementation of Google Provider which requests information about the user such as firstname/lastname etc&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Please Note&lt;/font&gt;:&lt;/strong&gt;&amp;#160; This addresses a bug with the existing google provider which does not return the extra data about the user such as Country/FirstName/LastName. The version of google provider is DotNetOpenAuth.AspNet&amp;quot; version=&amp;quot;4.0.3.12153&amp;quot;. We have logged a bug for this and will fix it in next update of this package. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; MyApplication&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; DotNetOpenAuth.OpenId.Extensions.AttributeExchange;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; DotNetOpenAuth.OpenId.RelyingParty;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="rem"&gt;/// Represents Google OpenID client.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; GoogleCustomClient : OpenIdClient&lt;/pre&gt;

  &lt;pre class="alt"&gt;    {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="preproc"&gt;#region&lt;/span&gt; Constructors and Destructors&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; GoogleCustomClient()&lt;/pre&gt;

  &lt;pre class="alt"&gt;            : &lt;span class="kwrd"&gt;base&lt;/span&gt;(&lt;span class="str"&gt;&amp;quot;google&amp;quot;&lt;/span&gt;, WellKnownProviders.Google) { }&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="preproc"&gt;#region&lt;/span&gt; Methods&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="rem"&gt;/// Gets the extra data obtained from the response message when authentication is successful.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name=&amp;quot;response&amp;quot;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// The response message. &lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;A dictionary of profile data; or null if no data is available.&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; GetExtraData(IAuthenticationResponse response)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            FetchResponse fetchResponse = response.GetExtension&amp;lt;FetchResponse&amp;gt;();&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (fetchResponse != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                var extraData = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;                extraData.Add(&lt;span class="str"&gt;&amp;quot;email&amp;quot;&lt;/span&gt;, fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email));&lt;/pre&gt;

  &lt;pre class="alt"&gt;                extraData.Add(&lt;span class="str"&gt;&amp;quot;country&amp;quot;&lt;/span&gt;, fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.HomeAddress.Country));&lt;/pre&gt;

  &lt;pre&gt;                extraData.Add(&lt;span class="str"&gt;&amp;quot;firstName&amp;quot;&lt;/span&gt;, fetchResponse.GetAttributeValue(WellKnownAttributes.Name.First));&lt;/pre&gt;

  &lt;pre class="alt"&gt;                extraData.Add(&lt;span class="str"&gt;&amp;quot;lastName&amp;quot;&lt;/span&gt;, fetchResponse.GetAttributeValue(WellKnownAttributes.Name.Last));&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; extraData;&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="rem"&gt;/// Called just before the authentication request is sent to service provider.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name=&amp;quot;request&amp;quot;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// The request. &lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request)&lt;/pre&gt;

  &lt;pre&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="rem"&gt;// Attribute Exchange extensions&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;            var fetchRequest = &lt;span class="kwrd"&gt;new&lt;/span&gt; FetchRequest();&lt;/pre&gt;

  &lt;pre class="alt"&gt;            fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);&lt;/pre&gt;

  &lt;pre&gt;            fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.HomeAddress.Country);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);&lt;/pre&gt;

  &lt;pre&gt;            fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;            request.AddExtension(fetchRequest);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Source Code for existing providers&lt;/h3&gt;

&lt;p&gt;The source code for existing providers is public and can be accessed at &lt;a href="https://github.com/AArnott/dotnetopenid/tree/master/src/DotNetOpenAuth.AspNet/Clients"&gt;https://github.com/AArnott/dotnetopenid/tree/master/src/DotNetOpenAuth.AspNet/Clients&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Register your provider with your application&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;WebForms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In App_Start/AuthConfig.cs register the custom provider as follows&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="csharpcode"&gt;

  &lt;div class="csharpcode"&gt;
    &lt;pre class="alt"&gt;OpenAuth.AuthenticationClients.Add(&lt;span class="str"&gt;&amp;quot;Custom Google&amp;quot;&lt;/span&gt;, () =&amp;gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; MyApplication.GoogleCustomClient());&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="rem"&gt;//OpenAuth.AuthenticationClients.AddGoogle();&lt;/span&gt;&lt;/pre&gt;

    &lt;pre class="alt"&gt;   &lt;/pre&gt;
  &lt;/div&gt;
  &lt;/div&gt;

&lt;p&gt;&lt;strong&gt;MVC&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In App_Start/AuthConfig.cs register the custom provider as follows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt; OAuthWebSecurity.RegisterClient(&lt;span class="kwrd"&gt;new&lt;/span&gt; MyApplication.GoogleCustomClient(),&lt;span class="str"&gt;&amp;quot;Google&amp;quot;&lt;/span&gt;,&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;           // OAuthWebSecurity.RegisterGoogleClient();&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;WebPages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In _AppStart.cshtml register the custom provider as follows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt; OAuthWebSecurity.RegisterClient(&lt;span class="kwrd"&gt;new&lt;/span&gt; MyApplication.GoogleCustomClient(),&lt;span class="str"&gt;&amp;quot;Google&amp;quot;&lt;/span&gt;,&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;           // OAuthWebSecurity.RegisterGoogleClient();&lt;/pre&gt;
&lt;/div&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10342789" width="1" height="1"&gt;</description></item><item><title>Extra Information from OAuth/OpenId Provider</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/22/extra-information-from-oauth-openid-provider.aspx</link><pubDate>Wed, 22 Aug 2012 19:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10342475</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10342475</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/22/extra-information-from-oauth-openid-provider.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you authenticate a user using the OAuth/OpenId providers, you can request for some extra information about the user if you have granted access for these providers to send this information.&lt;/p&gt;
&lt;p&gt;For eg if you login using Facebook, you can request information such as Gender, country etc.&lt;/p&gt;
&lt;p&gt;Each provider has different set of data that you can retrieve. I am not going to into the details of these different sets of data. In this post I am going to cover what kind of information can you retrieve from the implementations of the providers that we shipped with templates&amp;nbsp; in VS2012 and how can you retrieve this information.&lt;/p&gt;
&lt;h3&gt;What kind of information can you retrieve&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Google&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;email&lt;/li&gt;
&lt;li&gt;firstname&lt;/li&gt;
&lt;li&gt;lastname&lt;/li&gt;
&lt;li&gt;country&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://developers.google.com/accounts/docs/OpenID"&gt;https://developers.google.com/accounts/docs/OpenID&lt;/a&gt; is a good place to look for more information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Facebook &lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;id&lt;/li&gt;
&lt;li&gt;Name&lt;/li&gt;
&lt;li&gt;link&lt;/li&gt;
&lt;li&gt;gender&lt;/li&gt;
&lt;li&gt;accesstoken&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://developers.facebook.com/docs/"&gt;http://developers.facebook.com/docs/&lt;/a&gt; is a good place to look for more information&lt;/p&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Twitter&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;name&lt;/li&gt;
&lt;li&gt;location&lt;/li&gt;
&lt;li&gt;description&lt;/li&gt;
&lt;li&gt;url&lt;/li&gt;
&lt;li&gt;accesstoken&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a href="https://dev.twitter.com/docs/auth/oauth/faq"&gt;&lt;span style="font-weight: normal;"&gt;https://dev.twitter.com/docs/auth/oauth/faq&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt; is a good place to look for more information&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;How to retrieve this information&lt;/h3&gt;
&lt;p&gt;This data is available when you login using anyone of the providers. In specifics to the code you can access this data after the authentication has happened. The data is returned as a dictionary. Following image shows a snapshot of the data returned from facebook provider&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/8686.oauthextradata_5F00_46C21F10.png"&gt;&lt;img width="602" height="271" title="oauthextradata" style="display: inline; background-image: none;" alt="oauthextradata" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85-metablogapi/2816.oauthextradata_5F00_thumb_5F00_7F6CC91D.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Web Forms&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;!--StartFragment--&gt;
&lt;li&gt;Create the ASP.NET WebForm template&lt;/li&gt;
&lt;li&gt;Goto Account\RegisterExternalLogin.cs&lt;/li&gt;
&lt;li&gt;In the AuthenticationResult type we have Extradata dictionary bag which has this data&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;var authResult = OpenAuth.VerifyAuthentication(redirectUrl);&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;&lt;!--EndFragment--&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MVC&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create the internet template in MVC4&lt;/li&gt;
&lt;li&gt;Goto the account controller in ExternalLoginCallBack&lt;/li&gt;
&lt;li&gt;In the AuthenticationResult type we have Extradata dictionary bag which has this data&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt; AuthenticationResult result = &lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;                OAuthWebSecurity.VerifyAuthentication(Url.Action(&lt;span class="str"&gt;"ExternalLoginCallback"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; { ReturnUrl = returnUrl }));&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Web Pages&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;!--StartFragment--&gt;
&lt;li&gt;Create the webpages2 template&lt;/li&gt;
&lt;li&gt;Goto ExternalLoginCallBack&lt;/li&gt;
&lt;li&gt;In the AuthenticationResult type we have Extradata dictionary bag which has this data&lt;/li&gt;
&lt;!--EndFragment--&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt; AuthenticationResult result = &lt;/pre&gt;
&lt;pre&gt;                OAuthWebSecurity.VerifyAuthentication(Url.Action(&lt;span class="str"&gt;"ExternalLoginCallback"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; { ReturnUrl = returnUrl }));&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the following posts I will be spending more time showing you how you can customize our OAuth/OpenId stack and how you can customize and plugin your own providers&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10342475" width="1" height="1"&gt;</description></item><item><title>Releasing Microsoft ASP.NET Universal Providers Core 1.2</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/20/releasing-microsoft-asp-net-universal-providers-core-1-2.aspx</link><pubDate>Tue, 21 Aug 2012 00:15:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10341817</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10341817</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/08/20/releasing-microsoft-asp-net-universal-providers-core-1-2.aspx#comments</comments><description>&lt;p&gt;I hope everyone has been busy downloading Visual Studio 2012 and have started building awesome web applications. We have been busy too during this time.&lt;/p&gt;  &lt;p&gt;We have just released an update to the version of Universal Providers that shipped with VS2012. Following are the key changes with this release&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Address key performance issues with the providers &lt;/li&gt;    &lt;li&gt;Depends on &lt;a href="http://msdn.microsoft.com/en-us/data/aa937723" target="_blank"&gt;EntityFramework&lt;/a&gt; Code First &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;What should you do&lt;/h3&gt;  &lt;p&gt;This version of Universal Providers Core that shipped with VS2012 was 1.1. Take a moment and update to 1.2&lt;/p&gt;  &lt;p&gt;You can follow this documentation on&amp;#160; &lt;a href="http://docs.nuget.org/docs/start-here/Managing-NuGet-Packages-Using-The-Dialog#Updating_a_Package" target="_blank"&gt;how to update a nuget package&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;While updating you will get the &lt;a href="http://nuget.org/packages/EntityFramework" target="_blank"&gt;EntityFramework 5.0.0 package&lt;/a&gt; as well from the &lt;a href="http://nuget.org/" target="_blank"&gt;nuget.org&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Some common FAQ&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Works on .NET v4.0/4.5 &lt;/li&gt;    &lt;li&gt;Works on VS2010/VS2012 &lt;/li&gt;    &lt;li&gt;1.2 is compatible with 1.1 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Please do reach out to us on the following forum channels for any questions on universal providers&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;ASP.NET forums &lt;a href="http://forums.asp.net/25.aspx/1?Security"&gt;http://forums.asp.net/25.aspx/1?Security&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Stack Overflow: Use the tag “membership” Following are some questions for universal providers on SO &lt;a href="http://stackoverflow.com/search?q=universal+providers"&gt;http://stackoverflow.com/search?q=universal+providers&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All the best building awesome applications. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10341817" width="1" height="1"&gt;</description></item><item><title>ASP.NET v4.5 WebForms /VS11 @TechEd 2012 India</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/03/24/asp-net-v4-5-webforms-vs11-teched-2012-india.aspx</link><pubDate>Sat, 24 Mar 2012 08:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10287187</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10287187</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/03/24/asp-net-v4-5-webforms-vs11-teched-2012-india.aspx#comments</comments><description>&lt;div id="__ss_12137559" style="width: 425px;"&gt;&lt;/div&gt;
&lt;div style="width: 425px;"&gt;&lt;b&gt;I&amp;nbsp;&lt;/b&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt;gave talk around the new features comin\g up in ASP.NET v4.5/VS11 at Teched. The demo site/slides can be downloaded &lt;a href="https://skydrive.live.com/redir.aspx?cid=43459a6389a804d9&amp;amp;resid=43459A6389A804D9!1970&amp;amp;parid=43459A6389A804D9!1969" target="_blank"&gt;here&lt;/a&gt; . The slide deck is embedded below&lt;/strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="width: 425px;"&gt;&lt;/div&gt;
&lt;div style="width: 425px;"&gt;&lt;/div&gt;
&lt;div style="width: 425px;"&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt;&lt;a title="Webforms_TechEd" href="http://www.slideshare.net/rustd/webformsteched"&gt;Webforms_TechEd&lt;/a&gt;&lt;/strong&gt;&lt;object id="__sse12137559" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webformsfinal-120324005454-phpapp01&amp;amp;stripped_title=webformsteched&amp;amp;userName=rustd" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="wmode" value="transparent" /&gt;&lt;embed name="__sse12137559" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webformsfinal-120324005454-phpapp01&amp;amp;stripped_title=webformsteched&amp;amp;userName=rustd" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355" /&gt;&lt;/object&gt;&lt;/div&gt;
&lt;div id="__ss_12137559" style="width: 425px;"&gt;
&lt;div style="padding: 5px 0px 12px;"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/rustd"&gt;rustd&lt;/a&gt;.&lt;/div&gt;
&lt;div style="padding: 5px 0px 12px;"&gt;&lt;span style="font-size: large; background-color: #ffff00;"&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding: 5px 0px 12px;"&gt;Videos are now available on the tech ed site&amp;nbsp;&lt;a href="http://india.msteched.com/#agenda/agenda"&gt;http://india.msteched.com/#agenda/agenda&lt;/a&gt;&lt;/div&gt;
&lt;div style="padding: 5px 0px 12px;"&gt;Goto Day 3 to download the videos&lt;a href="http://india.msteched.com/#agenda/agenda"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://b.scorecardresearch.com/beacon.js?c1=7&amp;amp;c2=7400849&amp;amp;c3=1&amp;amp;c4=&amp;amp;c5=&amp;amp;c6=" type="text/javascript"&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10287187" width="1" height="1"&gt;</description></item><item><title>ASP.NET Standards &amp; Performance talk @TechEd India 2012</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/03/24/asp-net-standards-amp-performance-talk.aspx</link><pubDate>Sat, 24 Mar 2012 08:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10287186</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10287186</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/03/24/asp-net-standards-amp-performance-talk.aspx#comments</comments><description>&lt;p&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt;I gave talk around some&amp;nbsp; of the work the ASP.NET team is doing around standards support and improving performance in IIS8. The demo site/slides can be downloaded &lt;a href="https://skydrive.live.com/redir.aspx?cid=43459a6389a804d9&amp;amp;resid=43459A6389A804D9!1972&amp;amp;parid=43459A6389A804D9!1969" target="_blank"&gt;here&lt;/a&gt; . The slide deck is embedded below&lt;/strong&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div id="__ss_12137542" style="width: 425px;"&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt;&lt;strong style="margin: 12px 0px 4px; display: block;"&gt; &lt;strong style="margin: 12px 0px 4px; display: block;"&gt;&lt;a title="Webstandards_TechEdIndia" href="http://www.slideshare.net/rustd/webstandardstechedindia" target="_blank"&gt;Webstandards_TechEdIndia&lt;/a&gt;&lt;/strong&gt; &lt;iframe height="355" marginheight="0" src="http://www.slideshare.net/slideshow/embed_code/12137542" frameborder="0" width="425" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/strong&gt;&lt;/strong&gt;
&lt;div style="padding: 5px 0px 12px;"&gt;View more &lt;a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank"&gt;PowerPoint&lt;/a&gt; from &lt;a href="http://www.slideshare.net/rustd" target="_blank"&gt;rustd&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: medium; background-color: #ffff00;"&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;Videos are now available on the tech ed site&amp;nbsp;&lt;a href="http://india.msteched.com/#agenda/agenda"&gt;http://india.msteched.com/#agenda/agenda&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;Goto Day 3 to download the videos&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10287186" width="1" height="1"&gt;</description></item><item><title>How to determine version of Local Sql Instance and your database</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/02/20/mapping-sql-mdf-file-versions-to-sql-product-versions.aspx</link><pubDate>Mon, 20 Feb 2012 23:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10270129</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10270129</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2012/02/20/mapping-sql-mdf-file-versions-to-sql-product-versions.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you have seen this error you&amp;nbsp; must have broken your head on figuring out what happened. Which sql product version does 655 maps to.? How do I know what sql version am I running&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffff00;"&gt;The database 'C:\USERS\Foo\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffff00;"&gt;Could not open new database 'C:\USERS\Foo\APP_DATA\ASPNETDB.MDF'. CREATE DATABASE is aborted.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffff00;"&gt;An attempt to attach an auto-named database for file C:\Users\Foo\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;How do I figure out what was the sql vesion I created my mdf file in. How do I figure out what will be the mdf file version which will be created by the current sql product version.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Following table lists the sql product version and the file version of the mdf file they correspond to.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;table border="1" cellpadding="0" cellspacing="0" valign="top"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;Sql&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;MDF File version&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;Product version &lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql7&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;515&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2000&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;539&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2005sp1&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;611&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2005sp2&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;612&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2008sp1(dev10sp1)&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;655&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;sql2008sp2&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2008sp3&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2008r2&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;661&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2012(RC0)&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;705&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;Microsoft SQL Server 2012 RC0 - 11.0.1750.32&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Sql2012(RC1/RTM)&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;706&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;Microsoft SQL Server 2012 RC0 - 11.0.1913.38&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How to get the file version of an mdf file without connecting via sql&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: medium;"&gt;&lt;strong&gt;Note:&amp;nbsp; These methods do not upgrade your database&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TSQL&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In VS Connect to a sql instance(".\SQLEXPRESS" or "(localdb)\v11.0") as follows&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85/8713.TSQLEditor.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-37-85/8713.TSQLEditor.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;T-SQL(Check the file version which will be generated by your sql instance)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note that this is a T-SQL command, so it needs to be run on a SQL connection to an instance with at least read access to the MDF. The database does not need to be attached to the instance.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The following command will return the version of master. If this version of your mdf file is higher than the version of the primary MDF being checked (as here), the database will be upgraded when attached:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;select DATABASEPROPERTYEX('master', 'version')&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;698&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;(1 row(s) affected)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;T-SQL(Check the file version of your mdf)&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffff00;"&gt;This method does not require you to attach the MDF to the instance (so your mdf file is not upgraded).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;dbcc checkprimaryfile ('c:\MyApp\AppData\foo.mdf', 2)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;property&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value&lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;Database name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;foo&lt;/p&gt;
&lt;p&gt;Database version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 695&lt;/p&gt;
&lt;p&gt;Collation&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;872468488&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;(3 row(s) affected)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DBCC execution completed. If DBCC printed error messages, contact your system administrator.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Without using TSQL&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffffff;"&gt;&lt;span style="color: #ff6600;"&gt;Disclaimer&lt;/span&gt;: I found this of this person blog. While this works for the most part, this method depends upon internals of mdf file format which are not guaranteed to work the same way and can change in the future&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://rusanu.com/2011/04/04/how-to-determine-the-database-version-of-an-mdf-file/"&gt;http://rusanu.com/2011/04/04/how-to-determine-the-database-version-of-an-mdf-file/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PS &amp;gt; get-content -Encoding Byte "foo.mdf" | select-object -skip 0x12064 -first 2&lt;br /&gt; 149&lt;br /&gt; 2&lt;br /&gt; PS &amp;gt; 2*256+149&lt;br /&gt; 661&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thus by doing any one of the above you can figure out what is the version of the mdf file that you have and what is the sql product version it corresponds to. :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10270129" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/VS/">VS</category></item><item><title>My Talk @VS Live 2011 - ASP.NET and VS11</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2011/10/19/my-talk-vs-live-2011-asp-net-and-vs11.aspx</link><pubDate>Wed, 19 Oct 2011 07:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10227388</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10227388</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2011/10/19/my-talk-vs-live-2011-asp-net-and-vs11.aspx#comments</comments><description>&lt;p&gt;I gave a talk today about the new features coming in ASP.NET and Visual Studio11. Please find the sample project that I used in my application. This application will only work on .NET Fx v4.5&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10227388" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-22-73-88/Talk_5F00_Outline4_5F00_1_5F00_new.zip" length="142655389" type="application/octet-stream" /></item><item><title>Improve Performance of your website</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2011/07/30/improve-performance-of-your-website.aspx</link><pubDate>Sat, 30 Jul 2011 17:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10191407</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10191407</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2011/07/30/improve-performance-of-your-website.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size: x-small;" size="2"&gt;I recently went to a talk about how to improve performance of your website. In this post I am going to share out the lessons I learnt while applying some of the best practices to my personal photo view application. The high level points I will be mentioning are not tied to web programing languages such as php, asp.net etc but more around javacript/css optimizations for the browser. In the end I will highlight some tools that I used for this exercise&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Functions of the Browser&lt;/h3&gt;
&lt;p&gt;When you make a request to the webpage in the browser following is what happens&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Requests are made to download the webpage/ JS files/ CSS files/ images&lt;/li&gt;
&lt;li&gt;DOM for the page is constructed as follows&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;CSS parser parses the css&lt;/li&gt;
&lt;li&gt;Javscript parser parses the javascript code&lt;/li&gt;
&lt;li&gt;html parser parses the html&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;javascript execution happens and changes to the DOM are made&lt;/li&gt;
&lt;li&gt;Formatting of the DOM by applying styles&lt;/li&gt;
&lt;li&gt;Layout of the page is created with different blocks&lt;/li&gt;
&lt;li&gt;page is rendered in the browser and the user sees the result&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Quite a lot of activities happening right? Lets build on this overall flow and see how can we optimize our site&amp;rsquo;s performance for each step&lt;/p&gt;
&lt;h3&gt;Network Requests&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No redirection calls.&lt;/strong&gt; Try to change the code so that it goes to the correct location. redirection means you are making 2 requests as compared to 1 so it will take more time for the user to get the response&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoid meta refresh&lt;/strong&gt;&amp;nbsp; to refresh content on the page or redirect to a different page after 5 sec(say you are showing an add). This approach is also not SEO optimized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use CDN &lt;/strong&gt;Use the servers closet to you to serve the content so it takes less time to download the content&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReuseConnection D&lt;/strong&gt;o not send response with Connection:close header -not efficient for the same request as the connection needs to be recreated useConnection: Keep-Alive&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Minimize Bytes Downloaded&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Use Compression&lt;/li&gt;
&lt;li&gt;Use Caching of the content where applicable&lt;/li&gt;
&lt;li&gt;Cache data requests in browser cache(eg jquery json result)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Standard File Capitalization&lt;/strong&gt; :Icon.png, icon.png are treated as separate downloaded file. make sure you are checking for&amp;nbsp; this while coding&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Efficiently Structure markup&lt;/h3&gt;
&lt;p&gt;This is critical to make sure the browser does the parsing of html, javasccript and css efficiently&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use html5 doctype. Use the latest ie standards mode&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use httpheader to specify mode&lt;/strong&gt;. Not metatag since at that time ie will use the ie9 by default. Need to do a bunch of resetting . IE uses httpheader to see which parser to use for the page&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Bad &amp;lt;meta http-equiv="X-UA-Compatible" content="IE-9" &amp;gt;&lt;/li&gt;
&lt;li&gt;Good: x-UA-Compatible:IE-9&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;Link css at the top of page &lt;/strong&gt;so they downloaded in order&lt;/li&gt;
&lt;ul&gt;&lt;ol&gt;&lt;!--StartFragment--&gt;&lt;/ol&gt;&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;Do Not use @import in css files&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Legacy browser do a sync block to download this and then build the css&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;Avoid embedded inline styles/js&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;This causes context switching b/w html and css/js parser reducing performance&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;No js in head &lt;/strong&gt;since the browser does a sync block to execute js since js can manipulate the page. If you have to&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Defer loading: &amp;lt;script src="script.js" type="text/javascript" defer="defer"&amp;gt;&amp;lt;/script&amp;gt;&lt;/li&gt;
&lt;li&gt;Async tag in html5 : &amp;lt;script async src="slow.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Include js in the end&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Optimize Media Usage&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Use Image Sprites&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;# network connections used to download are less&lt;/li&gt;
&lt;li&gt;Size of the content being downloaded is less&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;Image Formats&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Png- for the most common cases/jpeg for photo/jpeg-xr(photo high res)&lt;/li&gt;
&lt;li&gt;Decoding algo is factor to consider which algo to use&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;Use native image resolutions&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Get an image 500x500 and do not resize in the image tag as shown &amp;lt;img h=50 w=50 /&amp;gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Replace single pixel img/border radius with css3 gradient since decoding of the image take time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use datauril for small image&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;no network request needed to download the image&lt;/li&gt;
&lt;li&gt;eg. following code displays the windows folder icon on the webpage&lt;/li&gt;
&lt;li&gt;&amp;lt;img src="data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH&lt;/li&gt;
&lt;li&gt;5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0Ccg&lt;/li&gt;
&lt;li&gt;uWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7" width="16" height="14"&lt;/li&gt;
&lt;li&gt;alt="embedded folder icon"&amp;gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;h3&gt;Write Fast JS&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Do Minification of JS/CSS3&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Minimize dom interactions&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Do not query the dom directly in javascript. cache the DOM and use the cached DOM&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;h3&gt;Tools that I used&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Firebug &lt;a href="http://getfirebug.com/"&gt;http://getfirebug.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Yslow &lt;a href="http://developer.yahoo.com/yslow/"&gt;http://developer.yahoo.com/yslow/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Httpwatch &lt;a href="http://www.httpwatch.com/"&gt;http://www.httpwatch.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chrome timeline view &lt;a href="http://code.google.com/chrome/devtools/docs/timeline.html"&gt;http://code.google.com/chrome/devtools/docs/timeline.html&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Good for layout rendering issues&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Dynatrace ajax edition &lt;a href="http://ajax.dynatrace.com/ajax/en/"&gt;http://ajax.dynatrace.com/ajax/en/&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Evaluate user interaction - record actions - get more information on bottlenecks&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Browser Developer Tools. eg. in IE you can do F12 and inspect the DOM, debu your scripts&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hopefully you find this useful&amp;hellip;&lt;/p&gt;
&lt;p&gt;Cheers!!!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10191407" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Asp-Net/">Asp.Net</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/performance/">performance</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/javascript/">javascript</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/css/">css</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/HTML5/">HTML5</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/IE/">IE</category></item><item><title>IDN and punycode support in IIS</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/11/18/idn-and-punycode-support-in-iis.aspx</link><pubDate>Thu, 18 Nov 2010 09:45:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10093081</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10093081</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/11/18/idn-and-punycode-support-in-iis.aspx#comments</comments><description>&lt;p&gt;Over the past few days I have working with investigating IDN and punycode&amp;#160; and have come across some common questions around the scenario that we are trying to enable. So in this post I am trying to explain these terms and what do application developers care about.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is IDN?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;IDN stands for Internationalized Doman Name. These domain contain non ASCII chars. egs of such domain names are “café”,”bücher” etc.   &lt;br /&gt;For more details on the history of IDN and its formation please refer to the following wikipedia article.&lt;a title="http://en.wikipedia.org/wiki/Internationalized_domain_name" href="http://en.wikipedia.org/wiki/Internationalized_domain_name"&gt;http://en.wikipedia.org/wiki/Internationalized_domain_name&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is punycode?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Punycode is an encoding syntax to convert the IDN to an ASCII representation. The way the conversion works is if the domain name has non ascii characters then the coverter starts the encoded string with “xn—“, copies all the ascii characters and adds a “-“ followed by the encoded value of all the non ASCII characters. For more details on the algorithm please refer to &lt;a title="http://tools.ietf.org/html/rfc3492" href="http://tools.ietf.org/html/rfc3492"&gt;http://tools.ietf.org/html/rfc3492&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Why do we care about these?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Imagine a scenario where you built your website in Brazil and called it “www.café.br”. For your website to be discovered on the internet it has to be registered with a DNS system. DNS systems have a limitation where non ASCII characters are not allowed as host name. So the DNS system will store the punycode representation of the host. eg. the punycode representation for the above name is “www.xn--caf-dma.br” &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;How does it all work?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When you build a site with a host name that has non ASCII characters eg. “www.café.br”, you will register the site with a DNS. The DNS entry will be something like “&amp;lt;IP address &amp;gt; &lt;a href="http://www.xn--caf-dma.br"&gt;www.xn--caf-dma.br&lt;/a&gt;”&lt;/p&gt;  &lt;p&gt;A user would make the request to the site by typing in “www.café.br”. The browser would convert this url to its punycode representation and make a request with “&lt;a href="http://www.xn--caf-dma.br"&gt;www.xn--caf-dma.br&lt;/a&gt;” to the server. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Enabling IDN and punycode support on your IIS server&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;These steps are based off on Win Server 2008 R2 with IIS enabled&lt;/p&gt;  &lt;ol&gt;   &lt;ul&gt;     &lt;li&gt;       &lt;div&gt;Open inetmgr&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div&gt;Remove the default binding&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div&gt;Add a binding to café.br on port 80 &lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div&gt;Open %windir%\system32\drivers\etc\hosts and enter the punycode representation of the servername. Add the following to the file&lt;/div&gt;        &lt;ul&gt;         &lt;li&gt;           &lt;div&gt;127.0.0.1 xn--caf-dma.br&lt;/div&gt;         &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div&gt;Turn off any proxy settings so the request goes against the local DNS only.&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div&gt;Make a request to&amp;#160; &lt;a href="http://caf&amp;eacute;.br"&gt;http://café.br&lt;/a&gt;&amp;#160; and &lt;a href="http://xn--bchertest-q9a.de"&gt;http://xn--caf-dma.br&lt;/a&gt;&amp;#160; and you should see the default page&lt;/div&gt;     &lt;/li&gt;   &lt;/ul&gt; &lt;/ol&gt;  &lt;p&gt;Hopefully this would help understand the end to end scenarios around IDN and punycode and what it means for an application developer.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://charset.org/punycode.php" href="http://charset.org/punycode.php"&gt;http://charset.org/punycode.php&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://demo.icu-project.org/icu-bin/idnbrowser" href="http://demo.icu-project.org/icu-bin/idnbrowser"&gt;http://demo.icu-project.org/icu-bin/idnbrowser&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10093081" width="1" height="1"&gt;</description></item><item><title>Configuring Windows Server Core for ASP.NET</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/11/17/configuring-windows-server-core-for-asp-net.aspx</link><pubDate>Wed, 17 Nov 2010 06:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10092332</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10092332</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/11/17/configuring-windows-server-core-for-asp-net.aspx#comments</comments><description>&lt;div&gt;I was recently working on Windows ServerCore and had to dig around for&amp;nbsp;setting up the server&amp;nbsp;for running ASP.NET and also do mundane tasks around&amp;nbsp;adding applications to IIS and configuring the app&amp;nbsp;pools.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;Following is a list of commands for anyone working on ServerCore. These commands cover the basic tasks anyone has to deal with while configuring the server for AspNet scenarios.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Machine Settings&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Network configuration&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;netdom renamecomputer %computername%&lt;span&gt;&amp;nbsp; &lt;/span&gt;/newname:{newComputerName} &lt;/p&gt;
&lt;p&gt;netdom join %computername% /d:{domainName}&lt;span&gt;&amp;nbsp; &lt;/span&gt;/ud:{domain\Username} /pd:*&lt;/p&gt;
&lt;p&gt;Net localgroup Administrators :{domain\Username} /add&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Allow Remote Management in the Firewall and enable Remote Administration . . . . . .&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;netsh advfirewall set allprofiles settings remotemanagement enable&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Restart&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;Shutdown /r&lt;/p&gt;
&lt;p&gt;shutdown /r /t 0&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Eventvwr.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;div&gt;
&lt;p&gt;There is non on Windows server core so you use the following tool wevtutil.exe &lt;/p&gt;
&lt;p&gt;wevtutil.exe qe System /rd:true /c:3 /f:text&lt;/p&gt;
&lt;p&gt;wevtutil.exe qe Application /rd:true /c:3 /f:text&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Install IIS and set remote management&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://learn.iis.net/page.aspx/334/install-and-configure-iis-7-on-server-core/"&gt;http://learn.iis.net/page.aspx/334/install-and-configure-iis-7-on-server-core/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dism /online /enable-feature /featurename: IIS-ManagementService&lt;/p&gt;
&lt;p&gt;reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WebManagement\Server /v EnableRemoteManagement /t REG_DWORD /d 1&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Configuring ASP.NET applications and application pools&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Applications&lt;/span&gt;&lt;/p&gt;
&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: bold;"&gt;
&lt;li value="1" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle; font-weight: bold;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: bold;"&gt;"&lt;/span&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;appcmd list app" will list the applications&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: normal;"&gt;
&lt;li value="2" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;"appcmd add app /site.name:"Default Web Site" /physicalpath:"C:\test\Foo" /path:/Foo"&lt;/span&gt; &lt;/li&gt;
&lt;li style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-family: Calibri; font-size: 11pt;"&gt;"appcmd set app "Default Web Site" /?"&amp;nbsp; To&amp;nbsp; list all the properties supported by the website&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: normal;"&gt;
&lt;li value="4" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;"appcmd set app "Default Web Site/Foo" /?"&amp;nbsp; To&amp;nbsp; list all the properties supported by the app&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: normal;"&gt;
&lt;li value="5" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;"appcmd set app "Default Web Site/Foo" /applicationPool:[AppPoolName]"&amp;nbsp; to set the app pool that you want this app to run on. By default it is&amp;nbsp; defaultapppool&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;AppPools&lt;/span&gt;&lt;/p&gt;
&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: normal;"&gt;
&lt;li value="1" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;"appcmd list apppools" will list the app pools along with Fx version and pipeline modes&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: normal;"&gt;
&lt;li value="2" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;"appcmd set apppool "DefaultAppPool" /?"&amp;nbsp; To&amp;nbsp; list all the properties supported&lt;/span&gt; &lt;/li&gt;
&lt;li style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-family: Calibri; font-size: 11pt;"&gt;"appcmd set apppool "DefaultAppPool"&amp;nbsp; /enable32BitAppOnWin64:[true|false]"&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;ol type="1" style="font-style: normal; margin-top: 0in; unicode-bidi: embed; font-family: Calibri; direction: ltr; margin-bottom: 0in; margin-left: 0.375in; font-size: 11pt; font-weight: normal;"&gt;
&lt;li value="4" style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-style: normal; font-family: Calibri; font-size: 11pt; font-weight: normal;"&gt;"appcmd set apppool "DefaultAppPool" /managedPipelineMode:[Integrated|Classic]"&lt;/span&gt; &lt;/li&gt;
&lt;li style="margin-top: 0px; margin-bottom: 0px; vertical-align: middle;"&gt;&lt;span style="font-family: Calibri; font-size: 11pt;"&gt;"appcmd set apppool "DefaultAppPool" /managedRuntimeVersion:[v2.0|v4.0]"&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Accessing ASP.NET features like Session State Service and PerfCounters&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;AspNet State Service&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Query&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sc query type= service state= all&lt;/p&gt;
&lt;p&gt;Sc qc aspnet_state&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Start&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sc start aspnet_state&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pause&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sc pause aspnet_state&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Resume&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sc continue aspnet_state&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stop&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sc stop aspnet_state&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;PerfCounters&lt;/span&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;Use typeperf.exe(&lt;a href="http://technet.microsoft.com/en-us/library/cc753182(WS.10).aspx"&gt;http://technet.microsoft.com/en-us/library/cc753182(WS.10).aspx&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;strong&gt;Listallcounters&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;typeperf.exe -q "ASP.NET v4.0.30319"&lt;/p&gt;
&lt;p&gt;Sample output&lt;/p&gt;
&lt;p&gt;\ASP.NET v4.0.30319\Application Restarts&lt;/p&gt;
&lt;p&gt;\ASP.NET v4.0.30319\Applications Running&lt;/p&gt;
&lt;p&gt;\ASP.NET v4.0.30319\Requests Disconnected&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Verify the perfcounter count&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;typeperf.exe "\ASP.NET Applications v4.0.30319(*)\Requests Total" -sc 2&lt;/p&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/magazine/2009.02.geekofalltrades.aspx?pr=blog"&gt;http://technet.microsoft.com/en-us/magazine/2009.02.geekofalltrades.aspx?pr=blog&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Primer on server core commands &lt;a href="http://technet.microsoft.com/en-us/library/ee441258(WS.10).aspx"&gt;http://technet.microsoft.com/en-us/library/ee441258(WS.10).aspx&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/magazine/dd630943.aspx"&gt;http://technet.microsoft.com/en-us/magazine/dd630943.aspx&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/R2CoreASPNET"&gt;http://code.msdn.microsoft.com/R2CoreASPNET&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/"&gt;http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/&lt;/a&gt; &lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Enable automatic updates and force an update . . . . . .&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;Scregedit.wsf /au 4&lt;/p&gt;
&lt;p&gt;start /w net stop Wuauserv&lt;/p&gt;
&lt;p&gt;net start Wuauserv&lt;/p&gt;
&lt;p&gt;wuauclt /detectnow&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Kill a process&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;taskkill /PID &amp;lt;process ID&amp;gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10092332" width="1" height="1"&gt;</description></item><item><title>From Razor Helpers to MVC via NuGet</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/11/03/from-razor-helpers-to-mvc-via-nuget.aspx</link><pubDate>Wed, 03 Nov 2010 10:10:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10085337</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10085337</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/11/03/from-razor-helpers-to-mvc-via-nuget.aspx#comments</comments><description>&lt;p&gt;Over the last few days,&amp;#160; I have been working on a sample which shows how you can build your custom library of helpers using the Razor syntax and use NuGet to distribute this library as a package so that MVC or WebMatrix application developers can use this package of helpers. This is a great way of writing resuable helpers for most of the common tasks that developers would be doing and using NuGet distribution channel to reach out to all the developers.&lt;/p&gt;  &lt;p&gt;To start off, you can write the Razor helpers in the Editor of your choice(VS / WebMatrix). You can then write a console application that parses all these helper files and generates a binary out of it. The following code snippet shows you how you can compile a number of helper files into a binary. This program takes in &lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;a folder path where all helper files are located and generates a dll(RazorToMVCViaNuGet) in the same location. &lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.45%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; height: 302px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Input: path to the folder where the helper files are&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (args.Count&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() &amp;lt;= 0)&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;please input the helper folder location&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//folder where all helpers are stored&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; helperLocation = args[0].ToString();&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; helperdllName = &lt;span style="color: #006080"&gt;&amp;quot;RazorToMVCViaNuGet.dll&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; RazorInstallLocation = System.Environment.Is64BitOperatingSystem ? System.Environment.GetEnvironmentVariable(&lt;span style="color: #006080"&gt;&amp;quot;ProgramFiles(x86)&amp;quot;&lt;/span&gt;) : System.Environment.GetEnvironmentVariable(&lt;span style="color: #006080"&gt;&amp;quot;ProgramFiles&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; RazorBinaryLocation =RazorInstallLocation + &lt;span style="color: #006080"&gt;@&amp;quot;\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] compiledcode = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[100];&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; counter = 0;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//get the directory information for the helper filers&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;     DirectoryInfo dir = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DirectoryInfo(helperLocation);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (FileInfo file &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; dir.GetFiles())&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (file.Extension.Equals(&lt;span style="color: #006080"&gt;&amp;quot;.cshtml&amp;quot;&lt;/span&gt;))&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//instantiate razor engine&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;             StreamReader input = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StreamReader(file.FullName);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             WebCodeRazorHost host = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebCodeRazorHost(file.FullName);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;             RazorTemplateEngine engine = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RazorTemplateEngine(host);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//parse the helper file and generate the CCU&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;             GeneratorResults results = engine.GenerateCode(input);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;             CodeCompileUnit ccu = results.GeneratedCode;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;             CodeDomProvider codeProvider = (CodeDomProvider)Activator.CreateInstance(host.CodeLanguage.CodeDomProviderType);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;             StringBuilder output = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (StringWriter writer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StringWriter(output))&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;                 codeProvider.GenerateCodeFromCompileUnit(ccu, writer, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CodeGeneratorOptions());&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;             compiledcode[counter] = output.ToString();&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;             counter++;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;continue&lt;/span&gt;;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Generate a helper dll&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;     CSharpCodeProvider provider = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CSharpCodeProvider();&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Build the parameters for source compilation.&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;     CompilerParameters cp = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CompilerParameters();&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Add assembly reference to comile the dll&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;     cp.ReferencedAssemblies.Add(&lt;span style="color: #006080"&gt;&amp;quot;System.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;     cp.ReferencedAssemblies.Add(&lt;span style="color: #006080"&gt;&amp;quot;System.Web.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;     cp.ReferencedAssemblies.Add(&lt;span style="color: #006080"&gt;&amp;quot;System.Security.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt;     cp.ReferencedAssemblies.Add(&lt;span style="color: #006080"&gt;&amp;quot;System.Core.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum52"&gt;  52:&lt;/span&gt;     cp.ReferencedAssemblies.Add(RazorBinaryLocation + &lt;span style="color: #006080"&gt;&amp;quot;\\System.Web.WebPages.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum53"&gt;  53:&lt;/span&gt;     cp.ReferencedAssemblies.Add(RazorBinaryLocation + &lt;span style="color: #006080"&gt;&amp;quot;\\WebMatrix.Data.dll&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum54"&gt;  54:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Generate Class Library&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum55"&gt;  55:&lt;/span&gt;     cp.OutputAssembly = helperLocation + &lt;span style="color: #006080"&gt;&amp;quot;\\&amp;quot; + helperdllName;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum56"&gt;  56:&lt;/span&gt;     cp.GenerateExecutable = false;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum57"&gt;  57:&lt;/span&gt;     // Save the assembly as a physical file.&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum58"&gt;  58:&lt;/span&gt;     cp.GenerateInMemory = false;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum59"&gt;  59:&lt;/span&gt;     // Invoke compilation.             &lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum60"&gt;  60:&lt;/span&gt;     CompilerResults cr = provider.CompileAssemblyFromSource(cp, compiledcode);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum61"&gt;  61:&lt;/span&gt;     if (cr.Errors.Count &amp;gt; 0)&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum62"&gt;  62:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum63"&gt;  63:&lt;/span&gt;         // Display compilation errors.&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum64"&gt;  64:&lt;/span&gt;         Console.WriteLine(&amp;quot;Errors building&lt;span style="color: #006080"&gt;&amp;quot;);&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum65"&gt;  65:&lt;/span&gt;         foreach (CompilerError ce in cr.Errors)&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum66"&gt;  66:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum67"&gt;  67:&lt;/span&gt;             Console.WriteLine(&amp;quot;  {0}&lt;span style="color: #006080"&gt;&amp;quot;, ce.ToString());&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum68"&gt;  68:&lt;/span&gt;             Console.WriteLine();&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum69"&gt;  69:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum70"&gt;  70:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum71"&gt;  71:&lt;/span&gt;     else&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum72"&gt;  72:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum73"&gt;  73:&lt;/span&gt;         Console.WriteLine(&amp;quot;Source success&amp;quot;);&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum74"&gt;  74:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum75"&gt;  75:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="csharpcode"&gt;For eg. the following picture shows the folder with the helper files, their content and the generated library. As you see in the picture the RazorToMVCViaNuGet.dll contains the compiled code the Razor Helpers.&lt;/div&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/1050.Helperdll_5F00_2E14508A.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Helperdll" border="0" alt="Helperdll" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/3632.Helperdll_5F00_thumb_5F00_45CB87F0.png" width="835" height="495" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point we have a binary which has all the helpers. In the next steps I will show you how to create a Nuget package for this RazorToMVCViaNuGet.dll and add it to the package feeds. Before I go any further you can get more information about installing Nuget and creating packages from &lt;a href="http://nuget.codeplex.com/" target="_blank"&gt;Nuget Codeplex site&lt;/a&gt;. Make sure you download Nupack.exe along with downloading NuGet. This exe does not come with the Nuget download and has to be downloaded separately from the same place as Nuget&lt;/p&gt;

&lt;p&gt;Now that you have NuGet and Nupack.exe, let’s create our package now.&lt;/p&gt;

&lt;p&gt;1. Create a folder called Demohelperpackage&lt;/p&gt;

&lt;p&gt;2. Create a .nuspec file based on the Nuspec format for a package. I created the following file DemoHelper.nuspec&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt;?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;package&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns:xsi&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns:xsd&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;metadata&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;RazorToMVCViaNuGet&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;1.1&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;authors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;pranavra&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;authors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;requireLicenseAcceptance&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;false&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;requireLicenseAcceptance&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Demo of how you can distribute razor helper using nuget&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;summary&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Razor helper to MVC via NuGet&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;summary&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;metadata&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--crlf--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;package&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/!--crlf--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;3. Create a folder called lib under Demohelperpackage and copy RazorToMVCViaNuGet.dll to this location&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4. copy nupack.exe to Demohelperpackage and run “NuPack.exe pack DemoHelper.nuspec” to generate the package&lt;/p&gt;

&lt;p&gt;5. You would see the a RazorToMVCViaNuGet.1.1.nupkgnupkg file created in the same folder&lt;/p&gt;

&lt;p&gt;Now that we have our package, we can test it out by having NuGet talk to a local feed rather than having NuGet talk to the official feed. You can refer how to do this from this page &lt;a href="http://nuget.codeplex.com/wikipage?title=Hosting Your Own Local and Remote NuPack Feeds" target="_blank"&gt;&amp;quot;Hosting Your Own Local and Remote NuPack Feeds&amp;quot;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have this setup you can use the Package Manager Console to list and install the package that you had just created.&lt;/p&gt;

&lt;p&gt;Create an ASP.NET MVC3 WebApplication to use this package in your project. Open the package manager console window.&lt;/p&gt;

&lt;p&gt;To see the list of packages you can do list-package which would list out your package.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/8507.image_5F00_0B03DF1A.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/1256.image_5F00_thumb_5F00_78BB1857.png" width="920" height="125" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;You can install the package using “Install-Package RazorToMVCViaNuGet” which would add the RazorToMVCViaNuGet.dll to your project&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/4621.image_5F00_03786FAD.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/3223.image_5F00_thumb_5F00_5C3E2677.png" width="904" height="122" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once the package is installed a&amp;#160; reference to RazorToMVCViaNuGet is added in your project&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/4212.image_5F00_37AC98F3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/5861.image_5F00_thumb_5F00_1B9BDA08.png" width="469" height="206" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;You can now use the helpers in RazorToMVCViaNuGet .dll in your views.Notice there is no namespace needed for the helpers.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/0181.image_5F00_770A4C83.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/6763.image_5F00_thumb_5F00_0EC183EA.png" width="491" height="312" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;When you run the application then Wola!!!! you would see that you were able to distribute and use your helpers :)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/2234.image_5F00_0736147D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/6378.image_5F00_thumb_5F00_5F8F9852.png" width="589" height="301" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This shows how easy it is to compile your own library of Razor helpers which you can distribute using NuGet to MVC/WebMatrix developers&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Future Improvements&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1. The sample only works for .cshtml file and can be extended for .vbhtml files as well&lt;/p&gt;

&lt;p&gt;2. Nuspec for this helper can be extended to have a dependency on Microsoft.AspNet.WebPages to be installed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10085337" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Razor/">Razor</category><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/NuGet/">NuGet</category></item><item><title>ASP.net assembly loading from GAC or Bin</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/10/18/asp-net-assembly-loading-from-gac-or-bin.aspx</link><pubDate>Mon, 18 Oct 2010 06:37:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10077185</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10077185</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/10/18/asp-net-assembly-loading-from-gac-or-bin.aspx#comments</comments><description>&lt;p&gt;For quite a while I have been going back and forth reading msdn documentations to figure out how does an assembly gets loaded at runtime. When an assembly is in the bin of your application and also in the GAC, what gets loaded at runtime, GAC or bin? This post is a quick reference guide so that I come back to it and get the short answer rather than parse through the msdn documentation each time.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is the answer?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The Runtime first looks in the GAC and then in the probing path of the application which includes the bin to load an assembly.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What does this imply?&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If you have 2 assemblies with the same version, one in GAC and other in bin, the assembly in GAC is loaded &lt;/li&gt;    &lt;li&gt;If you have 2 assemblies with different versions, one in GAC and other in bin, and the version to load is not specified in the config, then GAC is loaded &lt;/li&gt;    &lt;li&gt;If you have 2 assemblies with different versions, one in GAC and other in bin, and the version to load is specified in the config, then the specified version of the assembly is loaded either from GAC or bin, wherever the runtime finds it first. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Reference:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/yx7xezcf.aspx" target="_blank"&gt;How the Runtime Locates Assemblies&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Tools:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/e74a18c4(v=VS.100).aspx" target="_blank"&gt;Fuslogvw.exe (Assembly Binding Log Viewer)&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10077185" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/pranav_rastogi/archive/tags/Asp-Net/">Asp.Net</category></item><item><title>A close look at the Razor Parse Tree</title><link>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/10/11/a-close-look-at-the-razor-parse-tree.aspx</link><pubDate>Mon, 11 Oct 2010 09:13:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10074024</guid><dc:creator>pranav rastogi</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/pranav_rastogi/rsscomments.aspx?WeblogPostID=10074024</wfw:commentRss><comments>http://blogs.msdn.com/b/pranav_rastogi/archive/2010/10/11/a-close-look-at-the-razor-parse-tree.aspx#comments</comments><description>&lt;p&gt;This is a part of the series where we take a deep dive into the inner workings and extensibility of the Razor parser. In this post we are going to take a detailed look at the parse tree that is generated&lt;/p&gt;  &lt;p&gt;To learn more about the workings of parser please see the &lt;a href="http://blog.andrewnurse.net/2010/07/05/InsideRazorNdashPart1NdashRecursivePingPong.aspx" target="_blank"&gt;post&lt;/a&gt; by Andrew&lt;/p&gt;  &lt;p&gt;In Razor parser the document starts in markup mode(MarkupBlock). Depending on what comes next the parser switches between markup and code mode. This post takes you through the different kinds of markup/code switches that can happen. There is a tool that you can download which generates a parse tree based on Razor syntax input. The tool works for both C# and VB&lt;/p&gt;  &lt;p&gt;So lets dive into the building blocks.&lt;/p&gt;  &lt;p&gt;At a high level the parsed tree comprises of Blocks which signify what type of Block is the parser parsing. Blocks are the non leaf nodes of the parsed tree. Blocks can contain blocks which eventually terminate in Spans&lt;/p&gt;  &lt;p&gt;Following is a diagram which shows the high level structure for the Razor Parse Tree&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/8875.ParseTree_5F00_2E6A4681.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ParseTree" border="0" alt="ParseTree" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/2821.ParseTree_5F00_thumb_5F00_3227EB51.png" width="448" height="282" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;BLOCKS&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;Blocks can be of the following types&lt;/p&gt;  &lt;div align="center"&gt;   &lt;table border="1" cellspacing="0" cellpadding="2" width="502" align="center"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="138"&gt;&lt;strong&gt;Block Type&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="145"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="217"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;Markup&lt;/td&gt;          &lt;td valign="top" width="145"&gt;This is the type in which the Parser starts parsing the document. It comprises of Html markup text&lt;/td&gt;          &lt;td valign="top" width="217"&gt;Hello world&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;Section&lt;/td&gt;          &lt;td valign="top" width="145"&gt;This is the type where the parser parses the            &lt;br /&gt;@section construct&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@section Foo{}&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;Template&lt;/td&gt;          &lt;td valign="top" width="145"&gt;This is the type where the parser parses the inline templates being defined for the WebGrid helpers&lt;/td&gt;          &lt;td valign="top" width="217"&gt;           &lt;p&gt;&lt;code&gt;@grid.GetHtml(&lt;/code&gt;&lt;code&gt;columns: grid.Columns(&lt;/code&gt;&lt;/p&gt;            &lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;grid.Column(&amp;quot;Description&amp;quot;, format:@&amp;lt;&lt;/code&gt;&lt;code&gt;i&lt;/code&gt;&lt;code&gt;&amp;gt;@item.Description&amp;lt;/&amp;lt; CODE&amp;gt;&lt;code&gt;i&lt;/code&gt;&lt;code&gt;&amp;gt;)&lt;/code&gt;&lt;/code&gt;&lt;/p&gt;            &lt;p&gt;&lt;code&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;code&gt;)&lt;/code&gt;&lt;/code&gt;&lt;/code&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;           &lt;p&gt;Statement              &lt;br /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="145"&gt;The parser is parsing a Statement block&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@{            &lt;br /&gt;int x=1;             &lt;br /&gt;}&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;           &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Directive              &lt;br /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="145"&gt;Parser is parsing the top level directives of the page&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@using Microsoft.Web.Helpers&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;           &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Functions              &lt;br /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="145"&gt;Parser is parsing the functions block in the file&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@functions{}&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;           &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Expression              &lt;br /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="145"&gt;Parser is parsing any expressions block&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@System.DateTime.Now&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;           &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Helper&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="145"&gt;Parser is parsing the definition of @helper construct&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@helper HelperName(){}&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="138"&gt;Comment&lt;/td&gt;          &lt;td valign="top" width="145"&gt;Parsing is paring the block commenting support for commenting markup and code&lt;/td&gt;          &lt;td valign="top" width="217"&gt;@* comments which have markup and code            &lt;br /&gt;Markup: Hi             &lt;br /&gt;Code: @{}             &lt;br /&gt;*@&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Blocks contain the following information&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;BlockType&lt;/strong&gt;: One of the above kinds&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SourceLocation&lt;/strong&gt;: Location of the char in the file where the block started which is of the following representation (AbsoulteIndex: LineIndex: CharIndex :: Length of Block)&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;SPANS&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;Blocks are divided into the following Spans. Think of Spans as the leaf node in the ParseTree.&lt;/p&gt;  &lt;p&gt;The Spans contain information around the position of the span(line, col) and the content being parsed. This is useful in the cases of error reporting, syntax highlighting in the editor&lt;/p&gt;  &lt;div align="center"&gt;   &lt;table border="1" cellspacing="0" cellpadding="2" width="402" align="center"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="125"&gt;&lt;strong&gt;SpanKind&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="136"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="139"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="119"&gt;Transition&lt;/td&gt;          &lt;td valign="top" width="137"&gt;This span signifies that the parser parsed the @ character. &lt;/td&gt;          &lt;td valign="top" width="143"&gt;@ in @{}&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="117"&gt;MetaCode&lt;/td&gt;          &lt;td valign="top" width="137"&gt;This signifies the char which start and end a block&lt;/td&gt;          &lt;td valign="top" width="146"&gt;{} in @{} for Statement block            &lt;br /&gt;() in @() for Expression&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="115"&gt;Comment&lt;/td&gt;          &lt;td valign="top" width="136"&gt;All content in the Comment Block&lt;/td&gt;          &lt;td valign="top" width="148"&gt;foo in @* foo *@ is CommentSpan&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="114"&gt;Code&lt;/td&gt;          &lt;td valign="top" width="136"&gt;This type has all the code under the Statement/Expression block&lt;/td&gt;          &lt;td valign="top" width="149"&gt;System.DateTime.Now in @System.DateTime.Now&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="114"&gt;Markup&lt;/td&gt;          &lt;td valign="top" width="137"&gt;This type has the all the markup content in a markup block&lt;/td&gt;          &lt;td valign="top" width="150"&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt; in “@{} &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;”&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;I hope by now you would have a high level idea about the structure of the parse tree. At this point I have a sample input for razor file and I will walk you through the generated parse tree.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Spans contain the following information&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SpanType&lt;/strong&gt;: One of the above kinds&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SourceLocation&lt;/strong&gt;: Location of the char in the file where the block started which is of the following representation (AbsoulteIndex: LineIndex: CharIndex :: Length of Span)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Content:&lt;/strong&gt; Content which is parsed as a Span&lt;/p&gt;  &lt;h5&gt;&lt;strong&gt;Sample Input for a Razor C# file&lt;/strong&gt;&lt;/h5&gt;  &lt;p&gt;1 + 1 = @(1+1)&lt;/p&gt;  &lt;h5&gt;&lt;strong&gt;GeneratedParseTree&lt;/strong&gt;&lt;/h5&gt;  &lt;p&gt;Markup Block at (0:0,0)::16 &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Markup Span [V;Any] at (0:0,0)::8 - [1 + 1 = ] (Document) &lt;/li&gt;    &lt;li&gt;Expression Block at (8:0,8)::6      &lt;ul&gt;       &lt;li&gt;Transition Span [V;None] at (8:0,8)::1 - [@] &lt;/li&gt;        &lt;li&gt;MetaCode Span [V;None] at (9:0,9)::1 - [(] &lt;/li&gt;        &lt;li&gt;Code Span [V;Any] at (10:0,10)::3 - [1+1] - [Terminator: &amp;lt;&amp;gt;] &lt;/li&gt;        &lt;li&gt;MetaCode Span [V;None] at (13:0,13)::1 - [)] &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Markup Span [V;Any] at (14:0,14)::2 - [\r\n] (Document) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;As you know Razor parser starts parsing with MarkupBlock, so in this case the first block is the MarkupBlock. After creating the markup block the parser sees that the next char in markup so it creates a MarkupSpan and puts all the markup content in this span&lt;/p&gt;  &lt;p&gt;When the parser sees @, it knows that the next characters have to do with code so it creates an ExpressionBlock. After creating the ExpressionBlock the parser parses the @ as a TransitionSpan&amp;#160; which means that we have transitioned from Markup-Code. ExpressionBlock have the following signature @() so the parser parses the ( as MetaCode span. At this point the parser parsers the remaining characters as CodeSpan until it sees the terminator char ) which is parsed as MetaCodeSpan&lt;/p&gt;  &lt;p&gt;After the CodeSpan, the ExpressionBlock does not anything else to be parsed and this the parser consumes the newline character as part of the MarkupBlock&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;ParseTreeViewer&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;If you found the above description about the ParseTree that gets generated for the Razor syntax, interesting then you should download this tool which lets generates the Parsed Tree for a given Razor syntax.&lt;/p&gt;  &lt;p&gt;This tool can be used for debugging your application, though I would say it is an advanced use. If you think that the parser is not parsing the input as expected, then you can use this tool to see the parse tree that gets generated and figure out what is wrong.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Screenshot of the tool&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/1832.image_5F00_18BFE817.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-37-85-metablogapi/6237.image_5F00_thumb_5F00_0D2A2AD8.png" width="582" height="375" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://cid-43459a6389a804d9.office.live.com/embedicon.aspx/Public/Samples/RazorParseTree.zip" target="_blank"&gt;Download&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;FAQ&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;1. You need to have Asp.Net WebPages installed on the machine&lt;/p&gt;  &lt;p&gt;2. If you select the “View In Browser” option then the tool generates a temp file “test.htm”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hopefully this would help you understand the structure of the generated parse tree for razor syntax. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10074024" width="1" height="1"&gt;</description></item></channel></rss>