<?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>Timlee's Blog</title><link>http://blogs.msdn.com/b/timlee/</link><description>Thoughts on the state of web development, ASP.NET, and MSDN documentation.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Hosting a SignalR application on Windows 2008r2 and IIS 7.5</title><link>http://blogs.msdn.com/b/timlee/archive/2013/03/21/hosting-a-signalr-application-on-windows-2008r2-and-iis-7-5.aspx</link><pubDate>Thu, 21 Mar 2013 16:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10404268</guid><dc:creator>TimLT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/timlee/rsscomments.aspx?WeblogPostID=10404268</wfw:commentRss><comments>http://blogs.msdn.com/b/timlee/archive/2013/03/21/hosting-a-signalr-application-on-windows-2008r2-and-iis-7-5.aspx#comments</comments><description>&lt;p&gt;ASP.NET &lt;a title="SignalR" href="http://www.asp.net/signalr" target="_blank"&gt;SignalR&lt;/a&gt; is Microsoft's new library for adding real-time functionality to applications.&amp;nbsp;&amp;nbsp; You can host ASP.NET applications with SignalR on Windows Server 2012 and IIS 8 (this setup provides full HTML 5 WebSocket API support for real-time functionality), or you can host on previous versions of Windows Server and IIS.&amp;nbsp;&amp;nbsp;Previous server versions do not offer websockets support, instead they use fallback transport mechanisms such as forever frames, server-sent events, and Ajax long polling.&amp;nbsp; For more information, see &lt;a href="http://www.asp.net/signalr/overview/introduction/transports-and-fallbacks" target="_blank"&gt;SignalR Transports&lt;/a&gt;.&amp;nbsp; Because previous server versions use fallback transport mechanisms, hosting on a previous server platform requires a few&amp;nbsp;extra steps to get your SignalR application working in all browsers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This posts pulls together several related steps that it takes to get a SignalR application working&amp;nbsp;on a common previous-version hosting scenario:&amp;nbsp;&amp;nbsp; Windows 2008r2 and IIS 7.5.&amp;nbsp;&amp;nbsp;You can see a listing of these and other steps for working with SignalR applications on the &lt;a href="https://github.com/SignalR/SignalR/wiki/Faq" target="_blank"&gt;SignalR Wiki FAQ page&lt;/a&gt;.&amp;nbsp; The application sample used to test the steps in this post is from the tutorial &lt;a href="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr" target="_blank"&gt;Getting Started with SignalR&lt;/a&gt;.&amp;nbsp; Instead of building the sample on .NET Framework 4.5 (as in the tutorial), I built it on .NET Framework 4, a common hosting scenario on IIS 7.5.&lt;/p&gt;
&lt;p&gt;Here's a summary of the required setup steps to host on Windows 2008r2 with IIS 7.5:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="#config"&gt;Update the SignalR application's web.config file&lt;/a&gt; to enable "run all managed modules for all requests" (for short, this is the RAMMFAR setting).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href="#htmlpage"&gt;Update the web page that uses SignalR&lt;/a&gt; to communicate with the server:&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Add a reference to the json2.js library.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Add a &amp;lt;meta&amp;gt; tag that forces the content to display in a recent browser mode.&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;a href="#winserver"&gt;Set up a Windows Server&amp;nbsp;2008r2 with IIS 7.5&lt;/a&gt; as follows:&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Install the .NET Framework version that your SignalR&amp;nbsp;application requires.&lt;/li&gt;
&lt;li&gt;Create a site and associate it with the appropriate application pool.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: large;"&gt;&lt;a name="config"&gt;&lt;/a&gt;Update the Signalr Application's Web.config File&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In your SignalR application's web.config file, add the RAMMFAR setting to enable running all managed modules for all requests.&amp;nbsp;This setting was required to get the SignalR sample application running in on Windows 2008r2 and IIS 7.5 in all browsers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;system.webServer&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;modules runAllManagedModulesForAllRequests="true"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/modules&amp;gt;&lt;br /&gt;&amp;lt;/system.webServer&amp;gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: large;"&gt;&lt;a name="htmlpage"&gt;&lt;/a&gt;Update the Web Page that Uses SignalR&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In the application web page that uses SignalR to communicate with the server, add the following code.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a reference to the json2.js JSON parser library.&amp;nbsp; This script provides a JSON parser for previous browser versions that don't have it.&amp;nbsp;You can add the script in one of two ways:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Add the &lt;a href="http://nuget.org/packages/json2/" target="_blank"&gt;NuGet package json2.js&lt;/a&gt; to your project, and then reference it in your web&amp;nbsp;page:&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;lt;script src="scripts/json2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Or as an alternative, reference json2.js&amp;nbsp;on a CDN:&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;lt;script src="&lt;a href="http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js"&gt;http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js&lt;/a&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add the following &amp;lt;meta&amp;gt; tag in the head section of the page.&amp;nbsp; This tag, specifically the &lt;strong&gt;IE=edge&lt;/strong&gt; value, &amp;nbsp;forces Internet Explorer to display content in the most recent version available, rather than earlier modes (such as IE7) which prevent SignalR code from working.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="padding-left: 90px;"&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a name="winserver"&gt;&lt;/a&gt;&lt;span style="font-size: large;"&gt;Set up Windows Server 2008r2 and IIS 7.5&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As noted, I built the sample SignalR application from the &lt;a href="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr" target="_blank"&gt;Getting Started with SignalR&lt;/a&gt; tutorial on .NET 4.&amp;nbsp; This is a common hosting scenario on Windows 2008r2 and IIS 7.5.&amp;nbsp;&amp;nbsp; The server was a new default&amp;nbsp;default installation of Windows Server 2008r2&amp;nbsp;and IIS 7.5.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install the required .NET Framework version.&amp;nbsp; In this case I installed &lt;a href="http://msdn.microsoft.com/en-us/library/vstudio/5a4x27ek(v=vs.100).aspx" target="_blank"&gt;.NET Framework 4&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Create a new site in IIS Manager,&amp;nbsp;and associate the site with an application pool.&amp;nbsp; Use&amp;nbsp;integrated mode application pools, classic mode is not supported for&amp;nbsp;SignalR. &amp;nbsp;For this application I used the ASP.NET v4.0&amp;nbsp;application pool.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After following the above setup steps, I was able to deploy the .NET Framework 4-based version of the &lt;a href="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr" target="_blank"&gt;Getting Started with SignalR&lt;/a&gt; sample to the server, and it worked perfectly in IE (versions 8, 9, and 10), Chrome, and Firefox even though it was using fallback transport methods (forever frames in IE, and server-sent events in the other browsers).&amp;nbsp;&amp;nbsp; The interesting thing for SignalR developers is that apart from the above steps, I didn't have to change a single line of the SignalR code anywhere in the application to make this work.&lt;/p&gt;
&lt;p&gt;This is a simple case but shows that SignalR&amp;nbsp;really does support "automatic fallback" to earlier transport mechanisms when websockets support is not available on the server.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10404268" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/timlee/archive/tags/asp-net/">asp.net</category><category domain="http://blogs.msdn.com/b/timlee/archive/tags/ASP-NET+SignalR/">ASP.NET SignalR</category></item><item><title>Publish the SignalR Getting Started Sample as a Windows Azure Web Site</title><link>http://blogs.msdn.com/b/timlee/archive/2013/02/27/deploy-the-signalr-getting-started-sample-as-a-windows-azure-web-site.aspx</link><pubDate>Wed, 27 Feb 2013 22:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10397948</guid><dc:creator>TimLT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/timlee/rsscomments.aspx?WeblogPostID=10397948</wfw:commentRss><comments>http://blogs.msdn.com/b/timlee/archive/2013/02/27/deploy-the-signalr-getting-started-sample-as-a-windows-azure-web-site.aspx#comments</comments><description>&lt;p&gt;Here's a quick walkthrough for publishing the ASP.NET SignalR Getting Started tutorial sample as a free Windows Azure Web Site.&amp;nbsp; This shows how simple it is to deploy and host an ASP.NET application that adds SignalR real-time functionality.&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;strong&gt;Note&lt;/strong&gt;:&amp;nbsp; HTML5 WebSocket transport is available in SignalR, but is not currently supported for Windows Azure Web Sites.&amp;nbsp; When WebSocket transport is not available, your SignalR application still works but uses the other available transports as described in the Transports section of the &lt;a title="Introduction to SignalR" href="http://www.asp.net/signalr/overview/getting-started/introduction-to-signalr" target="_blank"&gt;Introduction to SignalR&lt;/a&gt; documentation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get the &lt;a title="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr" href="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr" target="_blank"&gt;SignalR Getting Started tutorial sample&lt;/a&gt;&amp;nbsp;or the &lt;a href="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr-and-mvc-4"&gt;Getting Started with SignalR and MVC 4&lt;/a&gt; sample&amp;nbsp;running locally as described in the topic.&lt;/li&gt;
&lt;li&gt;Create a free &lt;a title="http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=A443DD604" href="http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=A443DD604" target="_blank"&gt;Windows Azure trial account&lt;/a&gt; (or use an existing Windows Azure account).&lt;/li&gt;
&lt;li&gt;Install&amp;nbsp;the &lt;a title="Windows Azure Downloads" href="http://www.windowsazure.com/en-us/downloads/" target="_blank"&gt;Windows Azure SDK for .NET&lt;/a&gt; for&amp;nbsp;Visual Studio 2012 or Visual Studio 2010 (if not already installed).&amp;nbsp; This provides the tools to deploy the project to a web site.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Deployment Steps&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;1. Log into the &lt;a title="https://manage.windowsazure.com/" href="https://manage.windowsazure.com/" target="_blank"&gt;Windows Azure Management Portal&lt;/a&gt; and click &lt;strong&gt;Web Sites&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-38-63/0763.sr_2D00_deploy1.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/0763.sr_2D00_deploy1.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. Click &lt;strong&gt;New&lt;/strong&gt;, select &lt;strong&gt;Web Site&lt;/strong&gt;, and click &lt;strong&gt;Quick Create&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-38-63/5327.sr_2D00_deploy2.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/5327.sr_2D00_deploy2.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3. Specify a URL and a region for your site.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/8562.sr_2D00_deploy3.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/8562.sr_2D00_deploy3.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;4. Click &lt;strong&gt;Create Web Site&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-38-63/5633.sr_2D00_deploy4.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/5633.sr_2D00_deploy4.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;5. After the site has been created and its status on the &lt;strong&gt;Web Sites&lt;/strong&gt;&amp;nbsp;tab shows as &lt;strong&gt;Running&lt;/strong&gt;, click on the site name to view the dashboard.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/6866.sr_2D00_deploy5.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/6866.sr_2D00_deploy5.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;6. In the site &lt;strong&gt;Dashboard&lt;/strong&gt;, click &lt;strong&gt;Download Publish Profile&lt;/strong&gt; and save the publishing profile to your computer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Security Note&lt;/strong&gt;:&amp;nbsp; The downloaded .publishsettings file contains your&amp;nbsp; credentials (unencoded) that are used to administer your Windows Azure subscriptions and services. The security best practice for this file is to store it temporarily outside your source directories (for example in the Libraries\Documents folder), and then&amp;nbsp; delete it once the import has completed. A malicious user gaining access to the publishsettings file can edit, create, and delete your Windows Azure services.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/5543.sr_2D00_deploy6.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/5543.sr_2D00_deploy6.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;7. Open the Visual Studio project you created for the SignalR tutorial, &amp;nbsp;right-click the project in &lt;strong&gt;Solution Explorer, and &lt;/strong&gt;then click &lt;strong&gt;Publish&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;8. In the &lt;strong&gt;Publish Web&lt;/strong&gt; | &lt;strong&gt;Profiles&lt;/strong&gt; tab, click &lt;strong&gt;Import&lt;/strong&gt; and then import the downloaded publishing profile.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/5164.sr_2D00_deploy7.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/5164.sr_2D00_deploy7.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;9. In the &lt;strong&gt;Publish Web&lt;/strong&gt; | &lt;strong&gt;Connections &lt;/strong&gt;tab, select &lt;strong&gt;Web Deploy&lt;/strong&gt; as the publish method, validate the connection, and then click &lt;strong&gt;Publish&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-38-63/1033.sr_2D00_deploy8.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-63/1033.sr_2D00_deploy8.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;10. When publishing is complete, you&amp;nbsp;can access the site and run the sample SignalR application.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&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=10397948" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/timlee/archive/tags/asp-net/">asp.net</category><category domain="http://blogs.msdn.com/b/timlee/archive/tags/ASP-NET+SignalR/">ASP.NET SignalR</category></item><item><title>Using the Library Package Manager with Add-on Libraries in Visual Studio</title><link>http://blogs.msdn.com/b/timlee/archive/2010/11/11/using-the-library-package-manager-with-add-on-libraries-in-visual-studio.aspx</link><pubDate>Thu, 11 Nov 2010 19:09:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10089710</guid><dc:creator>aspnetfan</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/timlee/rsscomments.aspx?WeblogPostID=10089710</wfw:commentRss><comments>http://blogs.msdn.com/b/timlee/archive/2010/11/11/using-the-library-package-manager-with-add-on-libraries-in-visual-studio.aspx#comments</comments><description>&lt;p&gt;Have you ever noticed how complex it can be to add, remove, and update libraries of code functionality in Visual Studio?&amp;#160; First you have to hunt all over the place to find the library you want.&amp;#160; Then you have to download it, and figure out how to install it.&amp;#160; Often, you find it has dependencies, which then means finding, downloading, and installing other libraries too.&amp;#160; After everything is installed and working, suppose one of the libraries you installed gets updated.&amp;#160; How will you find out about the update? How will you install it?&amp;#160; And if there are dependencies among libraries, how will they be affected?&amp;#160; Finally, when it’s time to remove a library, unless the library and its dependencies were installed as an integrated package, you get to experience the joy of reversing the installation process and removing each library.&amp;#160; As you know if you’ve done this, working with libraries can quickly become painful. &lt;/p&gt;  &lt;p&gt;Microsoft has released some new tools to streamline the process of finding, adding, and managing libraries and add-on packages in Visual Studio.&amp;#160; &lt;a href="http://nuget.codeplex.com/" target="_blank"&gt;NuGet&lt;/a&gt; is an open source package management system based on the .NET Framework.&amp;#160; The NuGet application has been added into Visual Studio in the form of the &lt;em&gt;Library Package Manager&lt;/em&gt;. In this post, I’ll demonstrate how to use the new &lt;em&gt;Library Package Manager&lt;/em&gt; to install and remove a library in Visual Studio 2010.&amp;#160; This also works in Visual Web Developer 2010 Express, which is what I’ll use here. &lt;/p&gt;  &lt;h2&gt;Installing the Library Package Manager&lt;/h2&gt;  &lt;p&gt;You can install the &lt;em&gt;Library Package Manager&lt;/em&gt; by downloading it directly as a Visual Studio extension (*.vsix file) from the &lt;a href="http://nuget.codeplex.com/releases/view/52017" target="_blank"&gt;NuGet downloads page&lt;/a&gt;, or you can install the latest Web Platform Installer and then install the ASP.NET MVC3 Release Candidate.&amp;#160; Here we’ll use the second approach.&lt;/p&gt;  &lt;p&gt;To install the &lt;em&gt;Library Package Manager&lt;/em&gt; in Visual Studio: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Run the latest release of &lt;a href="http://www.microsoft.com/web/gallery/install.aspx?appid=mvc3" target="_blank"&gt;Web Platform Installer&lt;/a&gt; (version 3.0).&amp;#160; You may have to click &lt;em&gt;Allow&lt;/em&gt; in your browser one or more times to enable the Web Platform Installer to load. &lt;/li&gt;    &lt;li&gt;Click &lt;em&gt;Install&lt;/em&gt; to start installing the ASP.NET MVC3 Release Candidate.&amp;#160; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/6724.pm0_5F00_222FF8B0.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="pm-0" border="0" alt="pm-0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/3107.pm0_5F00_thumb_5F00_69559EE2.jpg" width="554" height="387" /&gt;&lt;/a&gt;&amp;#160; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Working with Libraries and Packages&lt;/h2&gt;  &lt;p&gt;There are two ways you can use the &lt;em&gt;Library Package Manager&lt;/em&gt; in Visual Studio to work with packages:&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The &lt;em&gt;package manager window&lt;/em&gt;.&amp;#160; This is a simple UI window for adding, removing, and updating packages. &lt;/li&gt;    &lt;li&gt;The &lt;em&gt;package manager console&lt;/em&gt;.&amp;#160; This is a console-type window in which you can enter Powershell commands for adding, removing, and updating packages. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Using the Package Manager Window&lt;/h3&gt;  &lt;p&gt;In this section we’ll show how to use the &lt;em&gt;package manager window&lt;/em&gt; to manage packages in Visual Studio.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;To add a package using the &lt;em&gt;package manager window&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Start Visual Studio (in this post, I am using the free edition, Visual Web Developer 2010 Express). &lt;/li&gt;    &lt;li&gt;Click &lt;em&gt;New Web Site&lt;/em&gt;, and then create a new site or project.&amp;#160; In this post I will create an ASP.NET web site (Razor) to use with the package manager.       &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/3513.pm0a_5F00_48CAD640.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-0a" border="0" alt="pm-0a" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/0207.pm0a_5F00_thumb_5F00_6F98EC80.jpg" width="551" height="222" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;After the site is created, right-click the node for the site in Solution Explorer, and then click &lt;em&gt;Add Library Package Reference&lt;/em&gt;.       &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/2330.pm1_5F00_2F62D306.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-1" border="0" alt="pm-1" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/0218.pm1_5F00_thumb_5F00_082889D1.jpg" width="604" height="444" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;In the &lt;em&gt;Add Library Package Reference&lt;/em&gt; window, click &lt;em&gt;Online&lt;/em&gt; to display the list of available online packages.       &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/2450.pm2_5F00_75DFC30E.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-2" border="0" alt="pm-2" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/8228.pm2_5F00_thumb_5F00_39B3F766.jpg" width="604" height="406" /&gt;&lt;/a&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;In the &lt;em&gt;Search Online&lt;/em&gt; box type “logging” to search for available libraries with enhanced logging functionality.&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;Use the paging links at the bottom of the results window to scroll through the packages until you find the Elmah package.&amp;#160; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/8802.pm3_5F00_1504BE47.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-3" border="0" alt="pm-3" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/3034.pm3_5F00_thumb_5F00_11A3269F.jpg" width="604" height="370" /&gt;&lt;/a&gt;         &lt;br /&gt;&lt;strong&gt;Note&lt;/strong&gt;:&amp;#160; This is a good example of how the Library Package Manager helps you find useful packages.&amp;#160; If you didn’t know ahead of time that you wanted the Elmah logging package, you can search more generally to find a list of packages that supply the features you want. &lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;Select the &lt;em&gt;elmah&lt;/em&gt; package and then click &lt;em&gt;Install&lt;/em&gt;.&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;After the installation, completes, click &lt;em&gt;Close&lt;/em&gt;.&amp;#160; &lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;You can see the Elmah assembly appears in the &lt;em&gt;bin&lt;/em&gt; folder in Solution Explorer.&amp;#160; To demonstrate that you can now use the library, add the following block of Razor syntax and type Elmah. to see that Intellisense recognizes the library.&amp;#160; &lt;/p&gt;      &lt;pre class="brush: xml; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: true; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;@{
     Elmah.
}&lt;br /&gt;&lt;/pre&gt;

    &lt;p&gt;The following screen shot shows the Elmah assembly in &lt;em&gt;bin&lt;/em&gt;, and Intellisense working when you type “Elmah.” in a Razor code block.&amp;#160; &lt;/p&gt;

    &lt;br /&gt;

    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/5076.pm4_5F00_58F69E39.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-4" border="0" alt="pm-4" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/7217.pm4_5F00_thumb_5F00_5FA9A7BC.jpg" width="604" height="454" /&gt;&lt;/a&gt; 

      &lt;br /&gt;After you see the Intellisense working with the Elmah library, remove the code block you just added.&amp;#160; &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Now that you’ve seen how to add a package, let’s remove the same package. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To remove a package using the &lt;em&gt;package manager window&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In Solution Explorer, right-click the node for the site, and then click &lt;em&gt;Add Library Package Reference&lt;/em&gt;. &lt;/li&gt;

  &lt;li&gt;Click &lt;em&gt;Uninstall&lt;/em&gt; on the &lt;em&gt;elmah&lt;/em&gt; package in the &lt;em&gt;Add Library Package Reference&lt;/em&gt; window. 

    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/8306.pm5_5F00_386F5E87.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-5" border="0" alt="pm-5" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/2043.pm5_5F00_thumb_5F00_5F3D74C7.jpg" width="604" height="376" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Close the window.&amp;#160; The Elmah assembly has been removed from the &lt;em&gt;bin&lt;/em&gt; folder in Solution Explorer. 

    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/2746.pm6_5F00_33F8DDC0.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-6" border="0" alt="pm-6" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/1263.pm6_5F00_thumb_5F00_25BA64D0.jpg" width="604" height="457" /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h3&gt;Using the Package Manager Console&lt;/h3&gt;

&lt;p&gt;We’ve seen how to add and remove the Elmah library in a Visual Studio project, using the &lt;em&gt;package manager window&lt;/em&gt;.&amp;#160; Now we’ll go through the same process using the &lt;em&gt;package manager console&lt;/em&gt;.&amp;#160; This console gives you the ability to manage packages in a more powerful way, using Windows Powershell commands. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To add a package using the &lt;em&gt;package manager console: &lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In Visual Studio click &lt;em&gt;Tools | Library Package Manager | Package Manager Console&lt;/em&gt;.&amp;#160; The &lt;em&gt;package manager console&lt;/em&gt; window appears.&amp;#160; If you click the drop-down icon in the upper right corner of the window, you can select whether to display it as a floating or a docked window, or as a tabbed document. 

    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/0842.pm7_5F00_13719E0E.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-7" border="0" alt="pm-7" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/7536.pm7_5F00_thumb_5F00_0B79FBAC.jpg" width="604" height="341" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;To see the list of available packages in the console, at the prompt type &lt;em&gt;list-package&lt;/em&gt; and then press Enter.&amp;#160;&amp;#160; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/5557.pm8_5F00_324811EC.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-8" border="0" alt="pm-8" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/4503.pm8_5F00_thumb_5F00_51F6EBB4.jpg" width="604" height="409" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;If you are new to Windows Powershell command, at the prompt you can type &lt;em&gt;get-help *&lt;/em&gt; and then press Enter to display a list of available commands. 

    &lt;br /&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/6644.pm9_5F00_71A5C57C.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-9" border="0" alt="pm-9" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/1447.pm9_5F00_thumb_5F00_1C7E298F.jpg" width="604" height="410" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;To get help on a particular command, type &lt;em&gt;get-help [command]&lt;/em&gt;.&amp;#160; To display help for the &lt;em&gt;install-package&lt;/em&gt; command, type &lt;em&gt;get-help install-package&lt;/em&gt; and then press Enter.&amp;#160; &lt;br /&gt;The syntax and options for the &lt;em&gt;install-package&lt;/em&gt; command are displayed. 

    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/4174.pm10_5F00_5C481014.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-10" border="0" alt="pm-10" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/8206.pm10_5F00_thumb_5F00_3103790D.jpg" width="604" height="410" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;To install the Elmah package, type &lt;em&gt;install-package elmah&lt;/em&gt; and then press Enter.&amp;#160; After the installation completes, the Elmah assembly again appears in the &lt;em&gt;bin&lt;/em&gt; folder in Solution Explorer. 

    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/1348.pm11_5F00_5BDBDD1F.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-11" border="0" alt="pm-11" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/7217.pm11_5F00_thumb_5F00_34A193EA.jpg" width="604" height="465" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Optionally, you can add a block of code in the editor and type “Elmah.” as you did in the previous section, to demonstrate that the library is recognized by Intellisense. 
    &lt;br /&gt;After you establish that Intellisense recognizes the Elmah library, remove the test block of code. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that you’ve seen how to add a package, let’s remove the same package. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To remove a package using the &lt;em&gt;package manager console&lt;/em&gt;: &lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;To remove the Elmah package, at the prompt type &lt;em&gt;uninstall-package elmah&lt;/em&gt; and then press Enter.&amp;#160; After the removal completes, the Elmah assembly is no longer visible in the &lt;em&gt;bin&lt;/em&gt; folder.&amp;#160; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/1586.pm12_5F00_3C73EADD.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pm-12" border="0" alt="pm-12" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63-metablogapi/5518.pm12_5F00_thumb_5F00_2420D0C2.jpg" width="604" height="470" /&gt;&lt;/a&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Close the &lt;em&gt;package manager console&lt;/em&gt;. &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;You’ve seen how you can use the Library Package Manager in Visual Studio to find, add, and manage libraries and packages.&amp;#160; You can use the &lt;em&gt;package manager window&lt;/em&gt;, or the &lt;em&gt;package manager console&lt;/em&gt;, to do the same basic tasks.&amp;#160; In addition to adding and removing packages, you can also use these tools to update a package.&amp;#160; When updates are available, they are automatically displayed for your installed packages when you display them, and you can simply click an &lt;em&gt;Update&lt;/em&gt; button (in &lt;em&gt;package manager window&lt;/em&gt;) or run an &lt;em&gt;update-package [package name]&lt;/em&gt; command (in &lt;em&gt;package manager console&lt;/em&gt;) to update a package.&amp;#160; The nice thing is that this updates both a package and its dependencies if needed. &lt;/p&gt;

&lt;p&gt;You can also use the NuGet package management application to create packages of the type you installed here.&amp;#160; For information on creating basic packages, see &lt;a href="http://nuget.codeplex.com/documentation?title=Creating a Package" target="_blank"&gt;Creating a Package&lt;/a&gt; at the NuGet project. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10089710" width="1" height="1"&gt;</description></item><item><title>Working with HTML5 pages in WebMatrix and the Razor Syntax</title><link>http://blogs.msdn.com/b/timlee/archive/2010/08/06/working-with-html5-pages-in-webmatrix-and-the-razor-syntax.aspx</link><pubDate>Fri, 06 Aug 2010 17:07:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10047061</guid><dc:creator>aspnetfan</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/timlee/rsscomments.aspx?WeblogPostID=10047061</wfw:commentRss><comments>http://blogs.msdn.com/b/timlee/archive/2010/08/06/working-with-html5-pages-in-webmatrix-and-the-razor-syntax.aspx#comments</comments><description>&lt;p&gt;Most web developers know that HTML5 is &lt;a href="http://dev.w3.org/html5/spec/Overview.html" target="_blank"&gt;available&lt;/a&gt; and is already supported (though not completely supported in all its features) in the leading browsers.&amp;#160; See a &lt;a href="http://w3schools.com/html5/html5_new_elements.asp" target="_blank"&gt;summary of new tags and features in HTML5&lt;/a&gt;. Internet Explorer 8, Firefox 3.6+, and the latest versions of Safari and Chrome all have strong support for HTML5. Upcoming releases, including IE9, will improve the level of support.&amp;#160; For this reason, in Microsoft’s recent beta release of the &lt;a href="http://www.asp.net/webmatrix" target="_blank"&gt;WebMatrix&lt;/a&gt; development platform, the templates for creating a new HTML page or a new ASP.NET page that uses the Razor syntax (pages with a .cshtml or .vbhtml file extension), all use the new HTML5 doctype. &lt;/p&gt;  &lt;p&gt;Often when I develop web pages, I don’t think much about the doctype that is used; I want to get onto the “good stuff” and start writing code.&amp;#160; However, using the new HTML5 doctype and understanding it is worthwhile for the following reasons:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;HTML5 offers some significant new tags and improved options for rendering content. &lt;/li&gt;    &lt;li&gt;Using the HTML5 doctype declaration results in much simpler and cleaner code in your pages, as you’ll see. &lt;/li&gt;    &lt;li&gt;Using the HTML5 doctype forces most browsers to render your pages in a “standards” mode (which is a good thing if you want to use new HTML features and validate your pages—see this &lt;a href="http://hsivonen.iki.fi/doctype/" target="_blank"&gt;article&lt;/a&gt; for more on browser modes).&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;HTML5 Versus Previous DocTypes&lt;/h2&gt;  &lt;p&gt;Let’s start by comparing a plain HTML page declared with an earlier doctype to one that is declared using the HTML5 doctype.&amp;#160; The following block of code is the template for a new blank HTML page in Visual Studio 2010.&amp;#160; VS uses this same doctype for creating HTML pages and also ASP.NET pages (the ASP.NET pages add some additional ASP.NET-related tags, but the doctype and HTML tags are otherwise the same).&lt;/p&gt;  &lt;h3&gt;Visual Studio Page Template&lt;/h3&gt;  &lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: true; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; 
  &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;

&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;Notice that the doctype declaration element specifies the XHTML 1.0 Transitional doctype, and (on the second line) a URI for the doctype declaration file.&amp;#160; This doctype has been used for some time now in the VS templates for HTML and ASP.NET web pages.&amp;#160; Also, note that the &amp;lt;html&amp;gt; tag specifies a default namespace that includes the XHTML 1.0 elements.&amp;#160; &lt;/p&gt;

&lt;h3&gt;WebMatrix Page Template&lt;/h3&gt;

&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: true; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;

    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now in contrast, look at the above template that WebMatrix uses for HTML and ASP.NET pages with the Razor syntax.&amp;#160; You can see right away how much cleaner and simpler this is:&amp;#160; there’s no long DTD specifier or URI in the doctype, and you do not have to declare a namespace on the root &amp;lt;html&amp;gt; tag. This is really all you need to start taking advantage of HTML5 tags and content in your web pages.&amp;#160; As mentioned, most of the leading browsers already support HTML5 so this doctype will validate and the majority of HTML5 tags should render properly in leading browsers.&lt;/p&gt;

&lt;h2&gt;One More Item:&amp;#160; Character Encoding&lt;/h2&gt;

&lt;p&gt;One detail that the new page templates do not include is a &amp;lt;meta&amp;gt; tag that specifies character encoding.&amp;#160; To be clear, this is not strictly required and you can validate pages without it.&amp;#160; The above markup for the new page template validates at the &lt;a href="http://validator.w3.org/" target="_blank"&gt;W3 validation service&lt;/a&gt; even without the encoding declaration (although it does mention in a warning:&amp;#160; “No character encoding declared at document level”).&amp;#160; However, it is a really good idea, even a best practice, to declare a character encoding in your pages.&amp;#160; &lt;/p&gt;

&lt;p&gt;Here are some possible consequences of not declaring a character encoding:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;It can affect the rendering of your content.&amp;#160; If you use certain characters, and no encoding is specified, a browser may render them in some odd way. &lt;/li&gt;

  &lt;li&gt;It can create security vulnerabilities.&amp;#160; Without a character encoding, for example, users (whether intentionally or unintentionally) could enter characters in a form which would become active HTML (like a &amp;lt;script&amp;gt; tag) that would then be capable of executing.&amp;#160; Ultimately, you should both validate user input &lt;em&gt;and&lt;/em&gt; declare a character encoding, to minimize security vulnerabilities of this type. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To declare a character encoding in an HTML5 page is very simple.&amp;#160; In previous doctypes it required a fairly long, detailed &amp;lt;meta&amp;gt; tag with several attributes.&amp;#160; But in HTML5 pages, all you need is a &amp;lt;meta&amp;gt; tag with a &lt;strong&gt;charset&lt;/strong&gt; attribute, like the following examples which declares a utf-8 encoding:&lt;/p&gt;

&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: true; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;If you add an encoding declaration like this one to the standard page template in WebMatrix, you’ll have a validating doc with the character encoding declared, which is a good thing.&amp;#160; The following modified template is what I’ve been using to create my new HTML and .cshtml pages in WebMatrix, given that I use a utf-8 character encoding:&lt;/p&gt;

&lt;h3&gt;WebMatrix Page Template with Character Encoding Declared&lt;/h3&gt;

&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: true; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;

    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;This updated form of the template also validates on the W3 validation service, and it gives you a clean, straightforward way to declare an encoding in your pages.&amp;#160; &lt;/p&gt;

&lt;h2&gt;The Bottom line&lt;/h2&gt;

&lt;p&gt;The use of the new HTML5 doctype in the WebMatrix page templates gives you cleaner, simpler pages, and lets you take advantage of the new features in HTML5.&amp;#160; It’s a good idea to add to the template a &amp;lt;meta&amp;gt; tag that declares the character encoding you will use in your web pages, because it gives you more consistent rendering and helps to reduce security vulnerabilities.&amp;#160; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10047061" width="1" height="1"&gt;</description></item><item><title>Using @functions in an ASP.NET page with Razor Syntax</title><link>http://blogs.msdn.com/b/timlee/archive/2010/07/30/using-functions-in-an-asp-net-page-with-razor-syntax.aspx</link><pubDate>Fri, 30 Jul 2010 21:50:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10044419</guid><dc:creator>aspnetfan</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/timlee/rsscomments.aspx?WeblogPostID=10044419</wfw:commentRss><comments>http://blogs.msdn.com/b/timlee/archive/2010/07/30/using-functions-in-an-asp-net-page-with-razor-syntax.aspx#comments</comments><description>&lt;p&gt;In July Microsoft released the WebMatrix Beta. WebMatrix is a set of tools and technologies which includes a code editor, a development web server, various tools, and the new simplified "Razor syntax." The Razor syntax is a type of syntax for writing server code in ASP.NET pages. It is simple to use and has some affinity for PHP developers. You can find information on installing WebMatrix, and documentation on programming with the Razor syntax, on the ASP.NET site: &lt;a href="http://www.asp.net/webmatrix"&gt;http://www.asp.net/webmatrix&lt;/a&gt;. &lt;/p&gt; &lt;h3&gt;The @functions Block&lt;/h3&gt; &lt;p&gt;Chapter 2 of the documentation is titled &lt;a href="http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax"&gt;Coding with Razor Syntax&lt;/a&gt;. This documentation covers the basics of the new syntax. But one syntax feature that is not yet included in the beta documentation is the &lt;i&gt;@functions&lt;/i&gt; block. &lt;/p&gt; &lt;p&gt;The purpose of the &lt;i&gt;@functions&lt;/i&gt; block is to let you wrap up reusable code, like the methods and properties that are discussed in Chapter 2, and then be able to call those methods or properties from other parts of the page. Say that you have a common method called &lt;i&gt;GetUserName&lt;/i&gt;, and you need to call this method more than once in your code. It doesn't make sense to rewrite that same code every time you want to get a user name. By placing this method in an &lt;i&gt;@functions&lt;/i&gt; block, you can just call the &lt;i&gt;GetUserName&lt;/i&gt; method whenever you want. So the basic idea is, put reusable code in an &lt;i&gt;@functions&lt;/i&gt; block.&lt;/p&gt; &lt;h3&gt;The Structure of an @functions Block&lt;/h3&gt; &lt;p&gt;As you learn in Chapter 2, a block of code in Razor syntax begins with @, and then is contained with a pair of braces ( "{" and "}"). An &lt;i&gt;@functions&lt;/i&gt; block simply adds the functions keyword to a basic block, and looks like this:&lt;/p&gt; &lt;h4&gt;C#&lt;/h4&gt;&lt;pre class="brush: csharp; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;@functions {

    // Add code here.

}&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h4&gt;VB&lt;/h4&gt;&lt;pre class="brush: vb; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;@Functions

    ' Add code here.

End Functions&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Code Example of an @functions Block&lt;/h3&gt;
&lt;p&gt;The following code example contains a complete page showing a simple &lt;i&gt;@functions&lt;/i&gt; block. In the &lt;i&gt;@functions&lt;/i&gt; block at the top of the page, it declares a method named &lt;i&gt;HelloMessage&lt;/i&gt; and a property named &lt;i&gt;Age&lt;/i&gt;. Then the method and the property are both called within the body of the page to display their values. Note that when you call a method in the Razor syntax, you must use parentheses whether the method has a parameter or not. When you call the &lt;em&gt;Age&lt;/em&gt; property in the body of the page, because it is typed as an integer, you must call the &lt;em&gt;ToString&lt;/em&gt; method (including parentheses) to properly convert and display its value.&amp;nbsp; If the &lt;em&gt;Age&lt;/em&gt; property had been a string type property, you would not need to call the &lt;em&gt;ToString&lt;/em&gt; method to convert its value for display, and you would not need to use parentheses to call the property. &lt;/p&gt;
&lt;h4&gt;C#&lt;/h4&gt;&lt;pre class="brush: csharp; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;@functions {

    // Create a variable to store the age.
    int userAge = 0;
    
    // Pass a user name to this method.
    string HelloMessage(string user)
    {
        var msg = "Hi " + user + ", how are you?";
        return msg;
    }
    
    int Age
    {
        get 
        {
            return userAge;
        }
        set
        {
            userAge = value;
        }
    }
}&lt;/pre&gt;&lt;pre class="brush: csharp; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&lt;/pre&gt;&lt;pre class="brush: xml; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;!DOCTYPE html&amp;gt;

&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
        &amp;lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;
    @{
        // Here we set a value on the Age property. 
        // In a real page, you might retrieve the user's
        // age from a form or database, and then assign 
        // the value to the property.
        Age = 27;
      
    }
       
    &amp;lt;!-- Pass a hard-coded user name to the HelloMessage method. 
         In a real  page you would likely get the user name from 
         a login form or database, and pass it to the method.
    --&amp;gt;
    &amp;lt;p&amp;gt;The value of the &amp;lt;code&amp;gt;HelloMessage&amp;lt;/code&amp;gt; method: @HelloMessage("James")&amp;lt;/p&amp;gt;
    
    &amp;lt;!-- Because the Age property is typed as an int (a number), 
         you must convert it to a string to display the value.
    --&amp;gt;
    &amp;lt;p&amp;gt;The value of the &amp;lt;code&amp;gt;Age&amp;lt;/code&amp;gt; property: @Age.ToString()&amp;lt;/p&amp;gt;
    
&amp;lt;/body&amp;gt;
    
&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;h4&gt;VB&lt;/h4&gt;&lt;pre class="brush: vb; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;@Functions

    ' Create a variable to store the age.
    Dim userAge as Integer = 0

    Function HelloMessage(user as String) As String
        Dim msg = "Hi " &amp;amp; user &amp;amp; ", how are you today?"
        Return msg
    End Function
    
    Property Age() As Integer
        Get
            Return userAge
        End Get
        Set(ByVal value As Integer)
            userAge = value
        End Set
    End Property

End Functions&lt;/pre&gt;&lt;pre class="brush: xml; auto-links: false; collapse: false; first-line: 1; gutter: false; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;!DOCTYPE html&amp;gt;

&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
        &amp;lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;
    @Code
        ' Here we set a value on the Age property. 
        ' In a real page, you might retrieve the user's
        ' age from a form or database, and then assign 
        ' the value to the property.
        Age = 27
    
    End Code
        
    &amp;lt;!-- Pass a hard-coded user name to the HelloMessage method. 
         In a real  page you would likely get the user name from 
         a login form or database, and pass it to the method.
    --&amp;gt;
    &amp;lt;p&amp;gt;The value of the &amp;lt;code&amp;gt;HelloMessage&amp;lt;/code&amp;gt; method: @HelloMessage("James")&amp;lt;/p&amp;gt;
    
    &amp;lt;!-- Because the Age property is typed as an int (a number), 
         you must convert it to a string to display the value.
    --&amp;gt;
    &amp;lt;p&amp;gt;The value of the &amp;lt;code&amp;gt;Age&amp;lt;/code&amp;gt; property: @Age.ToString()&amp;lt;/p&amp;gt;
    
&amp;lt;/body&amp;gt;
    
&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;h3&gt;The Future of @functions Blocks&lt;/h3&gt;
&lt;p&gt;The &lt;i&gt;@functions&lt;/i&gt; block is a useful tool in the Razor syntax. It lets you develop reusable code and then call it from anywhere else that you want in your page. In future releases, it won't be surprising to see additional capabilities added to &lt;i&gt;@functions&lt;/i&gt; to make it even more useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10044419" width="1" height="1"&gt;</description></item><item><title>The New ASP.NET Default Web Template in Visual Studio 2010</title><link>http://blogs.msdn.com/b/timlee/archive/2010/06/14/the-new-asp-net-default-web-template-in-visual-studio-2010.aspx</link><pubDate>Mon, 14 Jun 2010 18:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10024711</guid><dc:creator>aspnetfan</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/timlee/rsscomments.aspx?WeblogPostID=10024711</wfw:commentRss><comments>http://blogs.msdn.com/b/timlee/archive/2010/06/14/the-new-asp-net-default-web-template-in-visual-studio-2010.aspx#comments</comments><description>&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;When Visual Studio 2010 hit the market in April 2010, it had a nice surprise for hard-working web developers: a new default ASP.NET web site template that you can use to jumpstart a new site. The new template improves on previous VS site templates by giving you some nice extras in the areas of commonly requested site infrastructure that many developers are likely to use.&lt;/p&gt;
&lt;p&gt;The basic elements of the new default ASP.NET web template:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A built-in membership infrastructure, including forms-based login, user account creation and management, and an auto-generated membership database. &lt;/li&gt;
&lt;li&gt;The Jquery library, a library of AJAX functionality that you can call from client script, fully integrated with VS Intellisense in the source editor. &lt;/li&gt;
&lt;li&gt;A base CSS stylesheet with a default theme and style definitions.&lt;/li&gt;
&lt;li&gt;A basic master page infrastructure. When you create a new content page for your site and link it to the default master page, the built-in membership infrastructure is automatically added to your page.&lt;/li&gt;
&lt;li&gt;Default and About ASPX pages integrated with the membership infrastructure.&lt;/li&gt;
&lt;li&gt;A global application page to contain application-level code. &lt;/li&gt;
&lt;li&gt;A web.config file preconfigured for membership and related features.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this post I'll give you a quick overview of the main details in the new default ASP.NET web template (from here on we'll call it the "default template.").&lt;/p&gt;
&lt;h2&gt;The Web Site Template and the Empty Web Template&lt;/h2&gt;
&lt;p&gt;One of the key things to note when you create a new site in VS 2010, is that there are two general template types for creating an ASP.NET site:&amp;nbsp; an empty template that contains no site content, and the default template that contains the items listed above. &lt;/p&gt;
&lt;p&gt;If you choose the &lt;b&gt;New Web Site&lt;/b&gt; project option in VS (also called the Web site project type), you will see these two templates referred to as sites. The &lt;b&gt;New Web Site&lt;/b&gt; dialog lists the templates as &lt;b&gt;ASP.NET Web Site&lt;/b&gt; and &lt;b&gt;ASP.NET Empty Web Site&lt;/b&gt;: &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/4760.template1_2D00_1.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;In the same way, if you choose the &lt;b&gt;New Project&lt;/b&gt; option in VS (also called the Web Application Project type), both templates are referred to as applications. The &lt;b&gt;New Project&lt;/b&gt; dialog lists the templates as &lt;b&gt;ASP.NET Web Application&lt;/b&gt; and &lt;b&gt;ASP.NET Empty Web Application&lt;/b&gt;: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/6330.template1_2D00_2.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;If you want to know more about when to create a web application project versus a web site project, see &lt;a href="http://msdn.microsoft.com/en-us/library/dd547590.aspx"&gt;Web Application Projects versus Web Site Projects&lt;/a&gt;. The reasons for choosing the web application project type versus the web site project type involve how you work in as a developer, and how you plan to deploy, debug, and update your web applications. &lt;/p&gt;
&lt;p&gt;If you create a site using the default template as a web application (using the &lt;b&gt;New Project&lt;/b&gt; option on the menu), it's true that you will see a few additional VS-related project folders and files in &lt;b&gt;Solution Explorer&lt;/b&gt; compared to the web site project type.&amp;nbsp; But again, the additional items relate to project-level options for how you prefer to compile, debug, and work with your project in VS, they do not mean that the site content or files in the default web template are any different. In short, the point to remember is that the site content and functionality in the default web template are the same, regardless which VS project type you use to create a site based on the default template. &lt;/p&gt;
&lt;p&gt;Here's a screen shot of &lt;b&gt;Solution Explorer&lt;/b&gt;. It shows the content of a new site created with the default template from the &lt;b&gt;New Web Site&lt;/b&gt; dialog:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/8422.template1_2D00_3.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;And here is a screen shot of &lt;b&gt;Solution Explorer&lt;/b&gt; for a new web application. It shows the content of a new application created with the default template from the &lt;b&gt;New Project&lt;/b&gt; dialog. When you examine the content of the site files, it is clear that, despite the addition of some VS-related project folders, the site content and features of this template are the same:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/8764.template1_2D00_4.png" border="0" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Membership and Login&lt;/h2&gt;
&lt;p&gt;The new ASP.NET web site template gives you a full membership infrastructure, preconfigured and ready to use from the first time you run the site in VS. As you can see from the previous screen shots of a new site created by the template, the &lt;b&gt;Account&lt;/b&gt; folder contains several ASPX files for changing passwords, login, and new user registration. &lt;/p&gt;
&lt;p&gt;The default master page, Site.Master, integrates the login functionality so that all site pages that link to this master page can utilize the membership and login.&lt;/p&gt;
&lt;p&gt;To demonstrate the included login and membership features, run the site in VS. When it loads the start page (default.aspx), if you click the &lt;b&gt;Log In&lt;/b&gt; link, it takes you to the login.aspx page:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/8875.template1_2D00_5.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;New users who do not yet have an account can follow the &lt;b&gt;Register&lt;/b&gt; link to proceed to the Register.aspx page. You may want to create a test user account on the Register page, which looks like the following screen shot:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/4810.template1_2D00_6.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After the first valid user has registered, the ASP.NET &lt;b&gt;CreateUserWizard&lt;/b&gt; control (which is used on the Register page) creates a new SQL Express database MDF file for the membership data. The file is created in the &lt;b&gt;App_Data&lt;/b&gt; folder. After you have created the new user account on the Register page, if you click &lt;b&gt;Refresh&lt;/b&gt; in &lt;b&gt;Solution Explorer&lt;/b&gt; you can see the new membership database:&lt;/p&gt;
&lt;p&gt;The ChangePassword page is not visibly linked into the site. However, it is fully integrated with the membership structure and uses the Site.master master page. If you select the ChangePassword.aspx file in &lt;b&gt;Solution Explorer&lt;/b&gt; and then press Ctrl + F5 to run the page, you can see it is fully functional. If you log into this page using a user account that you created previously, you can change a password. The following screen shot shows the form on the ChangePassword page:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/4111.template1_2D00_7.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In addition to the features of integrated login, registration, and management of membership, the Web.Config file contains entries preconfigured for membership, profiles, and roles. Membership and profiles are enabled of course, because the site template already uses them. Roles are currently disabled, but if you later decide to enable roles in your application (for instance, if you want to create permission-based roles such as "Admin", "Contributor", "Guest", and so on), the basic required entry is already in the configuration file. &lt;/p&gt;
&lt;p&gt;To create additional site pages wired up to the new membership infrastructure, just select Site.Master as the master page when you create a new ASPX page. Your new page is then hooked into the site's existing membership and login infrastructure.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;The Jquery Library&lt;/h2&gt;
&lt;p&gt;The Jquery library is not completely new to VS 2010, but the level of support for it is. The Jquery library was first added to VS 2008, around the time that ASP.NET version 3.5 was released. Jquery is a lightweight Javascript library that has become one of the most popular of its type on the web. Web developers use Jquery to quickly find and manipulate the UI of HTML controls with a minimum amount of client-side script. This enables developers to write powerful, AJAX-like client-side functionality into their applications, without having to write hundreds or even thousands of lines of complex, hard-to-maintain Javascript. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;In VS 2010, the Jquery library included is version 1.4.1, and it is the full, open version of Jquery. There are three Jquery files that the ASP.NET web template installs with a new site, as you can see from the screen shot of the Scripts folder within a newly created site:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/4403.template1_2D00_8.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;Each of the three files is used for a different development scenario.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Jquery-1.4.1-vsdoc.js&lt;/b&gt;: Used for design-time work only. Contains additional VS XML documentation-style comments (prefaced by "//"), which are included automatically by VS to provide Intellisense in the editor at design time.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Jquery-1.4.1.js&lt;/b&gt;: The full version of the Jquery library. This is a readable, commented version of the library file. It does not contain the extra comments to support Visual Studio Intellisense. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Jquery-1.4.1.min.js&lt;/b&gt;: This is a minimized version of the full library file, with all comments and white space removed. After you have sufficiently debugged your application and you are ready to deploy, you can use this version of the Jquery library to deploy your application.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;During development, you can add a reference to the regular Jquery-1.4.1.js file.&amp;nbsp; You do not need to reference the &lt;strong&gt;vsdoc&lt;/strong&gt; version of the file to get Intellisense to work; VS references the content of that file automatically. Here's an example of how to reference the Jquery library file using a &amp;lt;script&amp;gt; tag in an ASXP page:&lt;/p&gt;
&lt;p&gt;&amp;lt;script type="text/javascript" language="javascript" src="Scripts/jquery-1.4.1.js" /&amp;gt;&lt;/p&gt;
&lt;p&gt;After you have added this reference in a page, you will have full Intellisense on the Jquery library within &amp;lt;script&amp;gt; blocks, as you can see from the following screen shot showing Intellisense working on the base Jquery object:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/4314.template1_2D00_9.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For more information on using Jquery with VS to support ASP.NET AJAX, ASP.NET MVC development, see &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx"&gt;Scott Guthrie's blog article&lt;/a&gt;, the &lt;a href="http://jquery.com/"&gt;Jquery site&lt;/a&gt; itself, and Scott Hanselman's &lt;a href="http://www.hanselman.com/blog/jQuerytoshipwithASPNETMVCandVisualStudio.aspx"&gt;tutorial&lt;/a&gt;. Even though the blog entries are not based on the current version of Jquery included in VS, they give you a lot of helpful information for getting started with Jquery.&lt;/p&gt;
&lt;h2&gt;CSS Styles&lt;/h2&gt;
&lt;p&gt;The new ASP.NET web template also include a base CSS style sheet. The file is named Site.css. In the style sheet are definitions for a number of aspects of the site:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Common page elements: the body, links, headers.&lt;/li&gt;
&lt;li&gt;Common layout regions: columns, header, footer, page area.&lt;/li&gt;
&lt;li&gt;Display options for controls and forms.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because all these fundamental UI elements are predefined for you in the style sheet, it is fairly straightforward to update the styles in your site when you are ready to customize the look of your UI or create a theme.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;This&amp;nbsp;screenshot demonstrates some of the styling options provided by the CSS, including the style for the selected &lt;b&gt;About&lt;/b&gt; menu item: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/3301.template1_2D00_10.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;The second screenshot demonstrates the styling on the login form controls for registration. There is even styling provided for the missing form information messages:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/3618.template1_2D00_11.png" border="0" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Site page Structure&lt;/h2&gt;
&lt;p&gt;As mentioned earlier, the new ASP.NET web template gives you by default a master page named Site.master that implements the membership infrastructure and login controls for the site. The About and Default pages use Site.master, as do all the membership-related pages in the &lt;b&gt;Account&lt;/b&gt; folder, so they are all wired into the existing membership. If you create new ASPX pages and link them to Site.master as their master page, they of course will also be automatically included in the provided membership and login implementation with no coding required. &lt;/p&gt;
&lt;p&gt;The About and Default pages are also included in the top navigation menu you have seen in previous screen shots. The master page uses the ASP.NET &lt;b&gt;LoginView&lt;/b&gt; and &lt;b&gt;Menu&lt;/b&gt; controls to provide the menu of available pages, and the login UI. The &lt;b&gt;LoginView&lt;/b&gt; control provides different templates depending on what kind of login scenario is being addressed (an anonymous user, a logged-in user, etc.). The &lt;b&gt;Menu&lt;/b&gt; control provides one child &lt;b&gt;MenuItem&lt;/b&gt; control for each page linked to the top menu. If you create new site pages and want them to appear in the top navigation menu, you must add a new &lt;b&gt;MenuItem&lt;/b&gt; control to the &lt;b&gt;Menu&lt;/b&gt; control for each page (similar to the &lt;b&gt;MenuItem&lt;/b&gt; controls for the About and Default page in this screen shot):&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-63/2804.template1_2D00_12.png" border="0" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;Overall, you will find that new default ASP.NET web template adds a lot of useful functionality for creating a site. When you consider the amount of code it used to take just to code up a full site with a membership infrastructure, or a set of scripts for creating rich client-side UI effects or AJAX functionality, the features included in the new template seem like a nice addition for web developers. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;See Also&lt;/h2&gt;
&lt;p&gt;&lt;a target="_blank" href="http://docs.jquery.com/Main_Page" title="Jquery Library Documentation"&gt;Jquery Library Documentation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2010/02/08/jquery-1-4-1-intellisense-with-visual-studio.aspx" title="Scott Guthrie blog entry about Jquery 1.4.1 in VS"&gt;Scott Guthrie blog about Jquery 1.4.1 in Visual Studio&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://blogs.msdn.com/b/aspnetue/archive/2009/12/14/asp-net-web-application-projects-vs-web-site-projects-in-visual-studio.aspx" title="ASP.NET Web Application Projects versus Web Site Projects in Visual Studio"&gt;ASP.NET Web Application Projects versus Web Site Projects in Visual Studio&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/dd547590.aspx" title="Web Application Projects versus Web Site Projects"&gt;Web Application Projects versus Web Site Projects&lt;/a&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=10024711" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/timlee/archive/tags/web+site+template/">web site template</category><category domain="http://blogs.msdn.com/b/timlee/archive/tags/Visual+Studio+2010/">Visual Studio 2010</category><category domain="http://blogs.msdn.com/b/timlee/archive/tags/default+template/">default template</category><category domain="http://blogs.msdn.com/b/timlee/archive/tags/asp-net/">asp.net</category><category domain="http://blogs.msdn.com/b/timlee/archive/tags/jquery/">jquery</category></item></channel></rss>