<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>tostring.it</title>
	
	<link>http://tostring.it</link>
	<description>Imperugo's tech world</description>
	<lastBuildDate>Tue, 04 Jun 2013 11:47:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/override/tostring/it" /><feedburner:info uri="override/tostring/it" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>38.82571</geo:lat><geo:long>-77.439642</geo:long><item>
		<title>Automatic Data Validation</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/qgagReDzhCM/</link>
		<comments>http://tostring.it/2013/06/04/automatic-data-validation/#comments</comments>
		<pubDate>Tue, 04 Jun 2013 11:47:11 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[aop]]></category>
		<category><![CDATA[castle]]></category>
		<category><![CDATA[data annotation]]></category>
		<category><![CDATA[dependecyinjection]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[nuget]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=797</guid>
		<description><![CDATA[An easy way to validate automatically all input parameters for a method. It is possible using the Data Annotation and AOP (castle in my case)]]></description>
				<content:encoded><![CDATA[<p>What I really appreciate in <a title="Articles about ASP.NET MVC" href="http://tostring.it/category/webdev/aspnetmvc/" target="_blank">ASP.NET MVC</a> and <a title="Articles about Web API" href="http://tostring.it/category/webdev/webapi-webdev/" target="_blank">WebAPI</a> are the binders and its validation. It’s really cool to have a class with all parameter and, for those who have the data annotations, the automatic validation.</p>
<p>In this article, I’m going to “speak” about the validation, probably one of the most boring stuff a developer needs do during the programming.</p>
<p>That’s what I mean with “boring stuff”</p>
<pre class="brush: csharp; gutter: true">public class UserService
{
  public void CreateUser(string username, string email, string website)
  {
    if(string.IsNullOrEmpty(username))
    {
      throw new ArgumentException(&quot;The username must contain a valida value&quot;);
    }

    if(string.IsNullOrEmpty(email))
    {
      throw new ArgumentException(&quot;The email must contain a valida value&quot;);
    }

    if(!Regex.IsMatch(email,&quot;^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$&quot;))
    {
      throw new ArgumentException(&quot;The specified email is not valid.&quot;);
    }

   if(!string.IsNullOrEmpty(website) &amp;&amp; !Regex.IsMatch(website,&quot;^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&amp;=])?$&quot;))
   {
     throw new ArgumentException(&quot;The specified website is not valid.&quot;);
   }

   //DO YOUR CODE

  }
}</pre>
<p>As you can see in the method above there are four parameters and <strong>I need to validate three of them before starting to do anything</strong> (in the example website is validated only if it has a value).<br />
Probably you, and also me, wrote this code thousand and thousand times …. ok It’s time to remove that.</p>
<p>My idea is to use the <strong>Data Annotation Attributes</strong> for the parameters and, using the <strong><a title="AOP Wiki Definition" href="http://en.wikipedia.org/wiki/Aspect-oriented_programming" target="_blank">AOP</a> (Aspect Oriented Programming)</strong> and <a title="Interceptor Pattern Wiki Definition" href="http://en.wikipedia.org/wiki/Interceptor_pattern" target="_blank"><strong>Interceptor Pattern</strong></a>, <strong>run automatically the validation for all ours layer</strong>.</p>
<p>Probably all of you use a <strong>Dependency Injection Framework</strong> (if you don’t use it, you have to) like <a title="Castle Windsor Official Site" href="http://www.castleproject.org/" target="_blank">Castle Windsor</a>, <a title="Ninject Official Site" href="http://www.ninject.org/" target="_blank">Ninject</a>, <a title="Unity Official Site" href="https://unity.codeplex.com/" target="_blank">Unity</a> and so on.<br />
All of these offers the opportunity to inject some code before calling a method for a registered service (Interceptor Pattern).<br />
In my example I’m using Castle (I love it), but the code it’s easy to move to another framework.</p>
<p>Stop speaking and let’s start coding.</p>
<p>The first thing to do is to understand how to run manually the validation: <strong><a title="K. Scott Allen Official Blog" href="http://odetocode.com/blogs/all" target="_blank">K. Scott Allen</a></strong> wrote a good article here, so I’m starting from <a href="http://odetocode.com/blogs/scott/archive/2011/06/29/manual-validation-with-data-annotations.aspx" target="_blank">this</a>.</p>
<p>Now <strong>we have to create a container class for all the parameters and to add the Data Annotations</strong>. That’s important because we can’t use the Data Annotations directly on the parameter.<br />
If you did everything correct, your class now should looks like this:</p>
<pre class="brush: csharp; gutter: true">public class CreateUserRequest
{
  [Required]
  public string Username { get; set; }

  [Required]
  [EmailAddress]
  public string Email { get; set; }

  [Url]
  public string Website { get; set; }
}</pre>
<p>Because a method could have more than one parameter, and we don’t really need to validate all of these, it could be important to tell to the validation service (our interceptor) what needs to be validated and what doesn’t.<br />
For this reason I’ve created a custom attribute, <strong>ValidateAttribute</strong>:</p>
<pre class="brush: csharp; gutter: true">[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
public class ValidateAttribute : Attribute
{
}</pre>
<p>No comments for this code, <strong>it is used only like a marker</strong>.</p>
<p>Now change the signature of your method using the attribute and the input class like this:</p>
<pre class="brush: csharp; gutter: true">public class UserService
{
  public void CreateUser([Validate] CreateUserRequest request)
  {
    //DO SOMETHING
  }
}</pre>
<p>Good, everything is ready except for the interceptor, it’s time to create it:</p>
<pre class="brush: csharp; gutter: true">public class ValidationInterceptor : IInterceptor
{
  #region Fields

  private readonly IObjectValidator validator;

  #endregion

  #region Constructors and Destructors

  public ValidationInterceptor() : this(new DataAnnotationsValidator())
  {
  }

  public ValidationInterceptor(IObjectValidator validator)
  {
    this.validator = validator;
  }

  #endregion

  #region Public Methods and Operators

  public void Intercept(IInvocation invocation)
  {
    ParameterInfo[] parameters = invocation.Method.GetParameters();
    for (int index = 0; index &lt; parameters.Length; index++)
    {
      ParameterInfo paramInfo = parameters[index];
      object[] attributes = paramInfo.GetCustomAttributes(typeof(ValidateAttribute), false);

      if (attributes.Length == 0)
      {
        continue;
      }

      this.validator.Validate(invocation.Arguments[index]);
    }

    invocation.Proceed();
  }

  #endregion
}</pre>
<p>The interceptor logic is really simple. <strong>It iterates all parameters and, only for these who have my custom attribute, it calls the Validate method</strong>.</p>
<p>To use an interceptor is important to register it and add to your service:</p>
<pre class="brush: csharp; gutter: true">IWindsorContainer container = new WindsorContainer();

container.Register(Component.For&lt;IInterceptor&gt;().ImplementedBy&lt;ValidationInterceptor&gt;());

container.Register(Component.For&lt;UserService&gt;()
                  .ImplementedBy&lt;UserService&gt;()
                  .Interceptors&lt;ValidationInterceptor&gt;());</pre>
<p>That’s all, run the this code to have the validation:</p>
<pre class="brush: csharp; gutter: true">private static void Main(string[] args)
{
  IWindsorContainer container = new WindsorContainer();

  container.InizializeAttributeValidation();

  container.Register(Component.For&lt;IUserService&gt;()
                    .ImplementedBy&lt;UserService&gt;()
                    .EnableValidation());

  IUserService userService = container.Resolve&lt;IUserService&gt;();

  try
  {
    userService.CreateUser(new CreateUserRequest());
  }
  catch (ImperugoValidatorException e)
  {
    //Validation exception
    Console.WriteLine(e.Message);
  }
  finally
  {
    Console.ReadLine();
  }
}</pre>
<p><strong>From now, every time you call the method CreateUser (resolved by Castle), the validation will be automatically raised and, for the parameter with a wrong value, an ImperugoValidationExcpetion will throw, you can catch them and choose how to show the message.</strong></p>
<p>It’s not finished yet <img src='http://tostring.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley colorbox-797' /> . If you prefer, I’ve created a NuGet Package that helps to reduce the code. There are two packages:</p>
<ol>
<li><strong><a href="https://nuget.org/packages/Imperugo.Validation.Common/" target="_blank"><span style="line-height: 13px;">Imperugo.Validation</span></a></strong></li>
<li><strong><a href="https://nuget.org/packages/Imperugo.Valdation.Castle/" target="_blank">Imperugo.Validation.Castle</a></strong></li>
</ol>
<p>The first one contains only the necessary stuff to create the right interceptor; the second one is the Castle implementation (soon I’ll release also a package for <strong>Ninject</strong>, <strong>Unity</strong> and so on).</p>
<p>The first thing to do is to install the package (Castle in this case):</p>
<p><a href="http://tostring.it/wp-content/uploads/2013/06/Capture.jpg"><img class="aligncenter size-full wp-image-798 colorbox-797" alt="Capture" src="http://tostring.it/wp-content/uploads/2013/06/Capture.jpg" width="747" height="87" /></a></p>
<p>Now change the Castle code like this:</p>
<pre class="brush: csharp; gutter: true">IWindsorContainer container = new WindsorContainer();

container.InizializeAttributeValidation();

container.Register(Component.For&lt;UserService&gt;()
                  .ImplementedBy&lt;UserService&gt;()
                  .EnableValidation());</pre>
<p>If you use a different Framework and you like this validation, fork the repo <a title="Imperugo Validation repository" href="https://github.com/imperugo/Imperugo.Validation" target="_blank">here</a>, add the new Framework, and create a “<strong>pull request</strong>”.</p>
<p>All my code is available <a href="https://github.com/imperugo/Imperugo.Validation/tree/master/src/Imperugo.Validation.Castle.Sample" target="_blank">here</a>.</p>
<p>I’m working on the next release that is really faster because include a cache strategy, <strong>so stay tuned</strong>.</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/qgagReDzhCM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2013/06/04/automatic-data-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tostring.it/2013/06/04/automatic-data-validation/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=automatic-data-validation</feedburner:origLink></item>
		<item>
		<title>Some good resources for ASP.NET MVC</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/XP-SXpquvIs/</link>
		<comments>http://tostring.it/2013/05/02/some-good-resources-for-asp-net-mvc/#comments</comments>
		<pubDate>Thu, 02 May 2013 11:10:25 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[aspnetmvc]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=791</guid>
		<description><![CDATA[A set of useful articles for each section (Action Filters, Deploy, and so on) of ASP.NET MVC, with an introduction to each topic. It is very helpful for all people who want to learn MVC, but also for those who already know it but want to increase their knowledge]]></description>
				<content:encoded><![CDATA[<p>My last period is one of the busiest of my life but, thanks to <a href="https://www.simple-talk.com/blogs/author/14442-chris-massey/">Chris Massey</a>, I found the time to write about one of my favorite frameworks, <a href="http://tostring.it/category/webdev/aspnetmvc/" target="_blank">ASP.NET MVC</a>.</p>
<p>Chris’s idea is to collect the most useful articles for each section (Action Filters, Deploy, and so on) of the framework, with an introduction to each topic.<br />
Personally, I worked on the Deploy topic (it’s easy to recognize, it’s the article with the worst English).</p>
<p>I really like that approach because it is very helpful for all people who want to learn MVC, but also for those who already know it but want to increase their knowledge.</p>
<p>If you have feedback or you think there are some missing arguments, you can contact directly Chris (or write me here and I will do for you).</p>
<p>Enjoy the guide <a href="http://webdev.simple-talk.com/" target="_blank">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/XP-SXpquvIs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2013/05/02/some-good-resources-for-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://tostring.it/2013/05/02/some-good-resources-for-asp-net-mvc/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=some-good-resources-for-asp-net-mvc</feedburner:origLink></item>
		<item>
		<title>Caching Web API Requests</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/WecAaDY8hXc/</link>
		<comments>http://tostring.it/2013/03/19/caching-web-api-requests/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 10:03:32 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[WebAPI]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[webapi]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=785</guid>
		<description><![CDATA[There is an easy way to improve the performance of your API calls using Web API Library; in fact it is possible to manage the cache for the requests exactly like a browser]]></description>
				<content:encoded><![CDATA[<p>I wrote many times about <a href="http://tostring.it/category/webdev/webapi-webdev/" target="_blank">Web API</a>, so you should know about the library and the main differences between the client part of Web API and the server side; in this post I’m going to write about the client side of this cool library.<br />
Exactly like the “old” <em>System.Net.WebRequest</em> class, also the Web API client can manage the caching policy for all REST requests.</p>
<p>Before seeing the code, it’s important to understand what does it mean “<em>manage the caching policy</em>” and why we should do that.</p>
<p>The class HttpClient is created for web requests and it has all problems/features of a browser without the render and Javascript stuff.</p>
<p>All the modern browsers has an aggressive cache policy with the purpose of reducing the network traffic and increase the performances. The last point is really important: to execute operations faster browsers read a set of information from the response header (Etag, Cache-Control and Date), and, based on their values, it decides to take the data from the response or from the cache.</p>
<p>In one of the latest projects we are working in my company (I spoke about that <a href="http://tostring.it/2012/12/03/manage-cookies-using-web-api/" target="_blank">here</a>), we have to call some rest services which totally ignore the cache header values. To be clear I’ve the same headers values for different results so I’ve to disable the cache for my request to that endpoint because the default behavior use the cache:</p>
<p>Default cache policy (from MSDN)</p>
<blockquote><p>Satisfies a request for a resource either by using the cached copy of the resource or by sending a request for the resource to the server. The action taken is determined by the current cache policy and the age of the content in the cache. This is the cache level that should be used by most applications.</p></blockquote>
<p>To change the cache policy we need to do something like that:</p>
<pre class="brush: csharp; gutter: true">using (WebRequestHandler handler = new WebRequestHandler())
{
  handler.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.BypassCache);

  using (HttpClient client = new HttpClient(handler))
  {
    response = await client.GetAsync(&quot;http://www.mysite.com/api/something/&quot;);
  }
}</pre>
<p>As you can see is really simple and really important so, be careful using the right Header values in your response J</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/WecAaDY8hXc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2013/03/19/caching-web-api-requests/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://tostring.it/2013/03/19/caching-web-api-requests/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=caching-web-api-requests</feedburner:origLink></item>
		<item>
		<title>Minify resources with source map at runtime using Web Essential</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/JBroxV-ZqN4/</link>
		<comments>http://tostring.it/2013/01/08/minify-resources-with-source-map-at-runtime-using-web-essential/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 09:31:14 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[aspnetmvc]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[minification]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=767</guid>
		<description><![CDATA[How to create a combined script with sourcemap support using aspnet mvc? Thanks to Webessential tools, there is an easy way to create a maintain your resources .... ]]></description>
				<content:encoded><![CDATA[<p>In one of the last versions of <strong>Web Essential Tools</strong>, Microsoft released one of my favorite features for the web development. I’m talking about the opportunity to create a bundle resource at runtime with the support of SourceMap.</p>
<p>The first step to try this cool feature is to install the Visual Studio plugin so, download it from <a title="Web Essential Tools download" href="http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6" target="_blank">here</a></p>
<p>After the installation Visual Studio offers you new features that are not available in the standalone version. In fact, after right clicking on a web resource (css, js, etc) in the solution explorer, you have a new “item” named Web Essential:</p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/001.png"><img class="aligncenter size-medium wp-image-763 colorbox-767" alt="001" src="http://tostring.it/wp-content/uploads/2013/01/001-300x179.png" width="300" height="179" /></a></p>
<p>&nbsp;</p>
<p>What I love most in this extension is the easy way to create the combined and minified resources (really, I’m not in love with the web optimization packages included in ASP.NET MVC 4).</p>
<p>What does it give us?</p>
<ul>
<li>Javascript and Css minification with SourceMap;</li>
<li>Javascript and Css bundle with SourceMap;</li>
</ul>
<p>As you can see in both items there is the <b>SourceMap, but what is it</b>?<br />
Source Map is a cool feature, actually supported just by Google Chrome, that allows you to understand the correct position (i.e. line of an error) in a Javascript file starting from a combined file.</p>
<p>I think that feature is a killer feature for frontend developers because some errors happened in production and, in some cases, you are not able to reproduce them during the tests.</p>
<p>The first things is to enable that features in chrome, so:</p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/002.png"><img class="aligncenter size-medium wp-image-768 colorbox-767" alt="002" src="http://tostring.it/wp-content/uploads/2013/01/002-300x179.png" width="300" height="179" /></a></p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/003.png"><img class="aligncenter size-medium wp-image-769 colorbox-767" alt="003" src="http://tostring.it/wp-content/uploads/2013/01/003-300x179.png" width="300" height="179" /></a></p>
<p>&nbsp;</p>
<p>From now, everything is easier, select your javascript files, right click and, from WebEssential Items, select “<strong>Create Javascript Bundle File</strong>”.</p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/004.png"><img class="aligncenter size-medium wp-image-770 colorbox-767" alt="004" src="http://tostring.it/wp-content/uploads/2013/01/004-300x187.png" width="300" height="187" /></a></p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/005.png"><img class="aligncenter size-medium wp-image-771 colorbox-767" alt="005" src="http://tostring.it/wp-content/uploads/2013/01/005-300x179.png" width="300" height="179" /></a></p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/006.png"><img class="aligncenter size-medium wp-image-772 colorbox-767" alt="006" src="http://tostring.it/wp-content/uploads/2013/01/006-300x179.png" width="300" height="179" /></a></p>
<p>&nbsp;</p>
<p>Drag you bundle into your page, MyExampleJavascriptBundle.min.js in my example, and everything is ready.</p>
<p>From now, every time you change and save the files you selected for the bundle, Visual Studio will automatically update it; it means that minified and source map will always be up to date with the original resources without doing anything special (How f..ing cool is that?).</p>
<p>As you can see in the image below there are more files that I’ve included in my page (see previous screenshots).</p>
<p style="text-align: center;"><a href="http://tostring.it/wp-content/uploads/2013/01/007.png"><img class="aligncenter size-medium wp-image-773 colorbox-767" alt="007" src="http://tostring.it/wp-content/uploads/2013/01/007-300x179.png" width="300" height="179" /></a></p>
<p>In fact, I didn’t added the files 001.js and 002.js but only the MyExampleJavascriptBundle.min.js.</p>
<p>How is it possible? The reason is really simple; inside the MyExampleJavascriptBundle.min.js, Visual Studio added a line with the path of Source Map that includes the original not combined files.</p>
<p>Chrome understands this behavior and shows you the source files (only if you use the developer tools bar).</p>
<p>If you like it and you want to understand more about Source Map, take a look <a href="http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/" target="_blank">here</a> and, if you like Web Essential like me you have to follow Mads on <a href="https://it.twitter.com/mkristensen" target="_blank">twitter</a></p>
<p>Stay tuned!</p>
<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/JBroxV-ZqN4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2013/01/08/minify-resources-with-source-map-at-runtime-using-web-essential/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tostring.it/2013/01/08/minify-resources-with-source-map-at-runtime-using-web-essential/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=minify-resources-with-source-map-at-runtime-using-web-essential</feedburner:origLink></item>
		<item>
		<title>Manage cookies using Web API</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/ARn0CIXmHhM/</link>
		<comments>http://tostring.it/2012/12/03/manage-cookies-using-web-api/#comments</comments>
		<pubDate>Mon, 03 Dec 2012 12:19:43 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[WebAPI]]></category>
		<category><![CDATA[aspnetmvc]]></category>
		<category><![CDATA[webapi]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=756</guid>
		<description><![CDATA[WebAPI manages cookies in a different way from asp.net mvc and webforms. In this article there is all you need to understand where the cookies are and how to manage them]]></description>
				<content:encoded><![CDATA[<p>In my last project, I’ve deeply used WebApi, both for the client side and server side. In fact my application must call several REST endpoints developed with java and, after a code elaboration, I have to expose the data to other clients (javascript into an html page in this case).</p>
<p>One of the pillars request by the Java services (really is not a technology request but just from the implementation made by the external company) is to read all cookies from the response and then send them back to the next requests (like a proxy).</p>
<p>To make more clear where my app is, I realized the following chart:</p>
<p><a href="http://tostring.it/wp-content/uploads/2012/12/webapi-chart.png"><img class="aligncenter size-medium wp-image-757 colorbox-756" title="webapi chart" src="http://tostring.it/wp-content/uploads/2012/12/webapi-chart-270x300.png" alt="" width="270" height="300" /></a></p>
<p>As you can see the communication between my application and the Java Rest endpoint is based on the client library released with Web API.<br />
In fact,<strong> Web API is more than a service library used just to expose data</strong>; it includes a client library that makes very easy to execute a REST call, so let’s start to install the client package named “Microsoft ASP.NET Web API Client Libraries” from NuGet!</p>
<p><a href="http://tostring.it/wp-content/uploads/2012/12/webpi-nuget.png"><img class="aligncenter size-medium wp-image-758 colorbox-756" title="webpi nuget" src="http://tostring.it/wp-content/uploads/2012/12/webpi-nuget-300x44.png" alt="" width="300" height="44" /></a></p>
<p>From now on, if you need to create a web request, you should do something like in the code below:</p>
<pre class="brush: csharp; gutter: true">HttpClient client = new HttpClient();

HttpResponseMessage response = await client.GetAsync(requestUrl);

//response contains all you need</pre>
<p>My problem was to manage the cookie from the response, since I needed to read the cookies and then store them somewhere for the next request.<br />
Obviously, the example above is really simple and it’s not enough for me because I need to read all the cookies and then send them to the browser.</p>
<p>Fortunately, there is an easy way to read the cookies from an Http Response using Web Api client library.<br />
The first thing to do is to create an instance of <em>HttpClientHandler</em>, inizialize the<em> CookieContainer</em> collection and then use it the HttpClient Constructor:</p>
<pre class="brush: csharp; gutter: true">HttpClientHandler handler = new HttpClientHandler
                              {
                                UseCookies = true, 
                                UseDefaultCredentials = true, 
                                CookieContainer = new CookieContainer()
                              };

HttpClient client = new HttpClient(handler);

HttpResponseMessage response = await client.GetAsync(requestUrl);

// hanlder.CookieContainer contains your cookies</pre>
<p>Now, after the request, the <em>CookieContainer</em> should contain the correct cookies.  Now we need to manage the cookie’s type, since we have two different kind of responses: one for ASP.NET MVC and one for Web API.</p>
<p>The two frameworks have no shared assemblies, it means that the cookies are represented by different classes in different namespaces with the same kind of data and I’m in a weird situation:</p>
<ul>
<li>The Cookiecontainer contains a list of <strong>System.Net.Cookie</strong>;</li>
<li>The Web Api server request use <strong>System.Net.Http.Headers.CookieHeaderValue</strong>;</li>
<li>ASP.NET MVC uses <strong>System.Web.HttpCookie</strong>;</li>
</ul>
<p>Three different classes, the first one comes from the client and the others for the response to the browsers.</p>
<p>For this reason, I created a Cookie manager class that moves the data from a cookie class to another one.<br />
To use the cookie in ASP.NET MVC is really simple, we just need to use the HttpContext (Request or response, depends if you need to add or read a cookie) like the code below:</p>
<pre class="brush: csharp; gutter: true">//reading
HttpContext.Request.Cookies[&quot;cookieName&quot;];

//writing
HttpContext.Response.Cookies.Add(new HttpCookie(&quot;cookieName&quot;));</pre>
<p>For the Web API the approach is different. In fact, into the controller, there isn’t the HttpContext class like into MVC, so we need to manage the data using the HttpHeader like this:</p>
<pre class="brush: csharp; gutter: true">//reading
var cookies = actionContext.Request.Headers.GetCookies();

/adding
response.Headers.AddCookies(cookies);</pre>
<p>Now I’m able to read cookies from everywhere and my last goal is to find a valid entry point where to manage the cookie read/write for MVC and Web API (easy ActionInvoker J)</p>
<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/ARn0CIXmHhM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2012/12/03/manage-cookies-using-web-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://tostring.it/2012/12/03/manage-cookies-using-web-api/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=manage-cookies-using-web-api</feedburner:origLink></item>
		<item>
		<title>Different keys with RavenDb</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/CddtOPlX_LU/</link>
		<comments>http://tostring.it/2012/11/05/different-keys-with-ravendb/#comments</comments>
		<pubDate>Mon, 05 Nov 2012 12:47:58 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[ravendb]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=748</guid>
		<description><![CDATA[My first experience with a document database engine. RavenDB offers several cool features to denormalize data without going crazy, one of this is the include feature]]></description>
				<content:encoded><![CDATA[<p>In last period, I am spending so times to learn document databases, in my case <a title="RavenDB" href="http://ravendb.net/" target="_blank"><strong>RavenDB</strong> </a>and <a title="MongoDB" href="http://www.mongodb.org/" target="_blank"><strong>MongoDB</strong></a>. To be honest I am working only on Raven right now because it is friendlier for .NET developers but I promised myself to compare some features from these two awesome database engines.</p>
<p>One of the big difficult I found, is to create the right model. I said big because I’m used to design the model for relation database and here is really different. For example we do not have the join and we also need to denormalize the references (<a href="http://ravendb.net/docs/faq/denormalized-references">http://ravendb.net/docs/faq/denormalized-references</a>).</p>
<p>It is mandatory because each document must be independent as Oren wrote on the site:</p>
<blockquote><p><em>One of the </em><em>design principals that RavenDB adheres to is the idea that documents are independent, that all the data required to process a document is stored within the document itself</em></p></blockquote>
<p>Fortunately, Raven makes easy some stuff like update and loading, respectively using <strong>Patch API</strong> (<a href="http://ravendb.net/docs/client-api/partial-document-updates">http://ravendb.net/docs/client-api/partial-document-updates</a>) and <strong>Include</strong>.</p>
<p>The <strong>Include</strong> command is absolutely cool, it makes easy to load two documents with one roundtrip and it means only one thing, Faster!<br />
For the NHibernate users it reminds me a little the <em>Future</em> command, with an important different, here you can load only document that has a key to another one, in NH you can load also objects completely unlinked.</p>
<p>Let’s see my domain:</p>
<p><a href="http://tostring.it/wp-content/uploads/2012/11/domain.png"><img class="aligncenter size-medium wp-image-749 colorbox-748" title="domain" src="http://tostring.it/wp-content/uploads/2012/11/domain-300x284.png" alt="" width="300" height="284" /></a></p>
<p>It seems more complex that it really is. There is a <strong>Post</strong> class and <strong>ItemComments</strong>. The first one includes all you need to have in the aggregate view; the second one, combined with the first one, has all you need to show in the detail view or admin area (in the most blog enginea you don’t need to show the comments in the main page, otherwise you need in the permalink).</p>
<p>The only common thing between them is the property CommentsId into Post class (It’s called Id in ItemComments). With it, you can easily load both documents in the same time.<br />
Let’s see how to use it:</p>
<pre class="brush: csharp; gutter: true">Post item = new Post()
//populate the properties with your values

this.Session.Store(item);

ItemComments comments = new ItemComments
                          {
                            Approved = new List&lt;Comment&gt;(), 
                            Pending = new List&lt;Comment&gt;(), 
                            Spam = new List&lt;Comment&gt;(), 
                            Item = new ItemReference
                                     {
                                       Id = post.Id, 
                                       Status = post.Status, 
                                       ItemPublishedAt = post.PublishAt
                                     }
                          };

this.Session.Store(comments);
post.CommentsId = comments.Id;

this.Session.SaveChanges();

//To read both with only one request:

Post post = this.Session
				.Include&lt;Post&gt;(x =&gt; x.CommentsId)
				.Load(id);

ItemComments comments = this.Session.Load&lt;ItemComments&gt;(post.CommentsId);</pre>
<p>As you see in the diagram, the key for the Post is a simple integer but in the ItemComments it is a string. That is mandatory if you want to use the <strong>Include</strong> because in the string there is all Raven needs to load the document (the ID and the type, in this case ItemComments/12345 where 12345 is the id).</p>
<p>Different CLR types for the key means to extend the base class for all entities. Typically I have a base class (EntityBase in this model) that includes the ID, Creation Date and a calculate property to check the status of the entity.</p>
<pre class="brush: csharp; gutter: true">public class EntityBase&lt;T&gt;
	{
		#region Public Properties

		public DateTimeOffset CreatedAt { get; set; }

		public T Id { get; set; }

		public bool IsTransient
		{
			get
			{
				return this.Id == 0;
			}
		}

		#endregion
	}</pre>
<p>The property IsTransient could be helpful to understand if you have to execute some path or not.<br />
Using a generic CLR type for the ID the base class must be extended like this:</p>
<pre class="brush: csharp; gutter: true">public class EntityBase&lt;T&gt;
	{
		#region Public Properties

		public DateTimeOffset CreatedAt { get; set; }

		public T Id { get; set; }

		public bool IsTransient
		{
			get
			{
				return EqualityComparer&lt;T&gt;.Default.Equals(Id, default(T));
			}
		}

		#endregion
	}</pre>
<p>Now you can still use a base class with the same features having fun with RavenDB.</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/CddtOPlX_LU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2012/11/05/different-keys-with-ravendb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tostring.it/2012/11/05/different-keys-with-ravendb/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=different-keys-with-ravendb</feedburner:origLink></item>
		<item>
		<title>An amazing experience</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/vcaI5O33_oM/</link>
		<comments>http://tostring.it/2012/10/22/an-amazing-experience/#comments</comments>
		<pubDate>Mon, 22 Oct 2012 08:51:27 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[webnet12]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=729</guid>
		<description><![CDATA[The day after the conference. Yesterday something special is happened and I still cannot believe that the Web.Net European Conference is over. For me was the first conference as a promoter and it was an AMAZING experience]]></description>
				<content:encoded><![CDATA[<p>Yesterday something special is happened and I still cannot believe that the <a title="Yesterday something special is happened and I still cannot believe that the Web.Net European Conference is over.  For me was the first conference as a promoter and it was an AMAZING experience. More than 160 people from 11 different countries in the same building speaking about the future of the web (how F*ing cool is that?). The atmosphere was really cool and I met some incredible speakers. Rui had a wonderful speech about tiny frameworks, Massimiliano has hypnotized all people with his magic on JavaScript, Alessandro shocked his room using WebSockets and SignalR, Raf with TypeScript and the same happened with the others speakers (unfortunately I cannot see other sessions because the organization made me very busy). What more? A very nice Chris Massey!  Another incredible news is the conference drop. There were 165 people on 173 available sits, we are almost “dropless” and for me that means “ok the conference is really cool, keep on working”. We are thinking to replicate the conference somewhere in the Europe (probably during the spring), but one thing is for sure, next year we will still be here. You rock! " href="http://webnetconf.eu" target="_blank">Web.Net European Conference</a> is over.<br />
For me was the first conference as a promoter and it was an <strong>AMAZING experience</strong>. More than <strong>160 people from 11 different countries</strong> in the same building speaking about the future of the web (how F*ing cool is that?).</p>
<p>The atmosphere was really cool and I met some incredible speakers. <a title="Rui Carvalho" href="http://www.rui.fr/" target="_blank">Rui</a> had a wonderful speech about <a href="http://webnetconf.eu/#/Home/SessionDetails/14" target="_blank">tiny frameworks</a>, <a title="Massimiliano Mantione" href="https://twitter.com/m_a_s_s_i" target="_blank">Massimiliano</a> has hypnotized all people with <a href="http://webnetconf.eu/#/Home/SessionDetails/3" target="_blank">his magic on JavaScript</a>, <a title="Alessandro Giorgetti" href="http://www.primordialcode.com/" target="_blank">Alessandro</a> shocked his room using <a href="http://webnetconf.eu/#/Home/SessionDetails/2" target="_blank">WebSockets and SignalR</a>, <a title="Raffaele Rialdi" href="http://www.iamraf.net/" target="_blank">Raf</a> with <a href="http://webnetconf.eu/#/Home/SessionDetails/6" target="_blank">TypeScript and WebAPI</a> and the same happened with the others speakers (unfortunately I cannot see other sessions because the organization made me very busy).</p>
<p>What more? A very nice <a href="https://twitter.com/camassey" target="_blank">Chris Massey</a>!</p>
<p>Another incredible news is the conference drop. <strong>There were 165 people on 173 available sits</strong>, we are almost “dropless” and for me that means “ok the conference is really cool, keep on working”.</p>
<p>We are thinking to replicate the conference somewhere in the Europe (probably during the spring), but one thing is for sure, <strong>next year we will still be here</strong>.</p>
<p>You rock!</p>
<p>Several pictures:</p>
<p style="text-align: left;"><a href="https://www.facebook.com/media/set/?set=a.449784285062932.96788.365320503509311&amp;type=3" target="_blank"><img class="size-thumbnail wp-image-734 colorbox-729" style="border: 0px; margin: 0px;" title="003" src="http://tostring.it/wp-content/uploads/2012/10/003-150x150.jpg" alt="" width="150" height="150" /></a><a href="https://www.facebook.com/media/set/?set=a.449784285062932.96788.365320503509311&amp;type=3" target="_blank"><img class="size-thumbnail wp-image-733 colorbox-729" style="border: 0px; margin: 0px;" title="002" src="http://tostring.it/wp-content/uploads/2012/10/002-150x150.jpg" alt="" width="150" height="150" /></a><a href="https://www.facebook.com/media/set/?set=a.449784285062932.96788.365320503509311&amp;type=3" target="_blank"><img class="size-thumbnail wp-image-732 alignleft colorbox-729" style="border: 0px; margin: 0px;" title="001" src="http://tostring.it/wp-content/uploads/2012/10/001-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/vcaI5O33_oM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2012/10/22/an-amazing-experience/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://tostring.it/2012/10/22/an-amazing-experience/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=an-amazing-experience</feedburner:origLink></item>
		<item>
		<title>Use Less, Sass and Compass with ASP.NET MVC</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/slHWznVJSPA/</link>
		<comments>http://tostring.it/2012/09/27/use-less-sass-and-compass-with-asp-net-mvc/#comments</comments>
		<pubDate>Thu, 27 Sep 2012 10:11:54 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[Various]]></category>
		<category><![CDATA[aspnetmvc]]></category>
		<category><![CDATA[compass]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[msbuild]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=717</guid>
		<description><![CDATA[How to use the best CSS Frameworks into ASP.NET MVC? In this article you can see how to integrate Less, Sass and Compass into MVC just building it]]></description>
				<content:encoded><![CDATA[<p>In my last project, with my team, we chose to use <a title="Compass CSS" href="http://compass-style.org/" target="_blank">Compass</a> with <a title="Sass Css" href="http://sass-lang.com/" target="_blank">SASS</a> as <strong>CSS Authoring Framework</strong>.  Initially we was unsecure about that, the choice was very hard, the classic CSS allows you to find several guys who know it and it doesn’t require compilation unlike with Sass and <a title="Less Css" href="http://lesscss.org/" target="_blank">Less</a>.</p>
<p>I’m not a front end developer so my part in this adventure is to manage the project and to make easy the integration of Less/Sass with an ASP.NET MVC application.</p>
<p>My first question was something like &#8211; “<strong>Which is the best way to integrate Less or SaaS in an ASP.NET MVC application?</strong>” -</p>
<p>If you choose Less everything is easy, you can install “dotless” from nuget and create that bundle (this example is for MVC 4) transformation:</p>
<pre class="brush: csharp; gutter: true">public class LessTransform : IBundleTransform
{
  public void Process(BundleContext context, BundleResponse response)
  {
    response.Content = dotless.Core.Less.Parse(response.Content);
    response.ContentType = &quot;text/css&quot;;
  }
}

var myBundle = new StyleBundle(&quot;~/Content/css&quot;)
                  .Include(&quot;~/Content/site.css&quot;)
                  .Include(&quot;~/Content/Scss1.less&quot;);

myBundle.Transforms.Add(new LessTransform());
myBundle.Transforms.Add(new CssMinify());</pre>
<p>About Compass? …. mmmmm What is Compass? <img src='http://tostring.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley colorbox-717' /> </p>
<p>Compass is another framework built using Sass: if you want to use Compass you need Sass, so my first problem was to integrate Sass into my MVC application.<br />
In my previous <a title="The best extensions for Visual Studio 2012" href="http://tostring.it/2012/08/22/my-favorite-extensions-for-visual-studio-2012/" target="_blank">post</a> &#8220;Schmulik Raskin” suggested me <a title="Mindscape Web Workbench" href="http://www.mindscapehq.com/products/web-workbench" target="_blank">Mindscape&#8217;s Web Workbench</a>, a cool extension that offers you some features like Syntax Highlighting, Intellisense and Compilation not only for Sass but also for Less and CoffeeScript. That’s awesome.</p>
<p>Unfortunately after few hours I choose to use Web Workbench only like an editor and I disabled the compilationL.</p>
<p>Right now the extension doesn’t include some features that I need, like Compass support and output path customization. In spite of all, if you don’t need these features, probably Web Workbench still remains the best solution for .NET developer.</p>
<p>How did I sort out the problem?<br />
Using ruby and MS-Build together of course. If you want to do the same, follow the step below:</p>
<ul>
<li>Download and install the latest version of Ruby and add it to your environment path (I suggest you to use Ruby Installer, it has a wizard and asks you if you prefer to add ruby to your paths – say yes).</li>
<li>From a new prompt window check ruby installation: type “ruby –v” (in my case I got ruby 1.9.3p194 (2012-04-20) [i386-mingw32]);</li>
<li>Type “gem install compass” (it download compass and its dependencies);</li>
<li>Disable Web Workbench in your project “Menu =&gt; Mindscape =&gt; Web Workbench Settings” and uncheck your .scss files;</li>
<li>Right click on your ASP.NET MVC application and “Unload Project”;</li>
<li>Right click again on the unload project “Edit projectname.csproj”;</li>
</ul>
<p>Under Project section add the follows code:</p>
<pre class="brush: xml; gutter: true">&lt;Target Name=&quot;AfterCompile&quot; Condition=&quot; &#039;$(Configuration)&#039; == &#039;Release&#039; &quot;&gt;
  &lt;Exec Command=&quot;compass compile --output-style compressed --force&quot; /&gt;
  &lt;ItemGroup&gt;
    &lt;Content Include=&quot;Styles\*.css&quot; /&gt;
  &lt;/ItemGroup&gt;
&lt;/Target&gt;
&lt;Target Name=&quot;AfterCompile&quot; Condition=&quot; &#039;$(Configuration)&#039; == &#039;Debug&#039; &quot;&gt;
  &lt;Exec Command=&quot;compass compile&quot; /&gt;
  &lt;ItemGroup&gt;
    &lt;Content Include=&quot;Styles\*.css&quot; /&gt;
  &lt;/ItemGroup&gt;
&lt;/Target&gt;</pre>
<ul>
<li>Right click on the project for the last time and push “Reload Project”;</li>
</ul>
<p>Here we go! Your application is ready to use Ruby with Compass and Sass. How to use it? Just compile your website, MS-Build creates your “.css” from Compass for you.</p>
<p>The first part of the code (debug condition) just create a css file, the second one also minify the file (&#8211;output-style compressed &#8211;force).<br />
Moreover if you need to customize the compilation path and other stuff you can add a file config.rb into your project root and ruby will use that configuration for Compass.<br />
My file looks like that:</p>
<pre class="brush: ruby; gutter: true"># Require any additional compass plugins here.

# NORMALIZE: https://github.com/jzorn/compass-normalize-plugin
#require &quot;normalize&quot;

# set environment
environment = :development

# Set this to the root of your project when deployed:
http_path = &#039;/&#039;

css_dir = &quot;Styles/Shared&quot;
sass_dir = &quot;Styles/SCSS&quot;
fonts_dir = &quot;Styles/fonts&quot;
images_dir = &quot;Images&quot;
javascripts_dir = &quot;Scripts&quot;

# Set image path only
http_images_path = (environment == :production) ? &#039;http://tostring.it/&#039; + images_dir : &#039;/&#039; + images_dir

output_style = (environment == :production) ? :compressed : :expanded</pre>
<p>Amazing! You have the power of Compass inside a .NET application without using command line for compiling.</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/slHWznVJSPA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2012/09/27/use-less-sass-and-compass-with-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://tostring.it/2012/09/27/use-less-sass-and-compass-with-asp-net-mvc/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=use-less-sass-and-compass-with-asp-net-mvc</feedburner:origLink></item>
		<item>
		<title>The best extensions for Visual Studio 2012</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/0SAY0a3iKwo/</link>
		<comments>http://tostring.it/2012/08/22/my-favorite-extensions-for-visual-studio-2012/#comments</comments>
		<pubDate>Wed, 22 Aug 2012 14:05:24 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Addon]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=703</guid>
		<description><![CDATA[A set of my favorite extensions that makes Visual Studio 2012 absolutely cool. Resharper, VsCommand, GhostDoc, Web Essential and so on]]></description>
				<content:encoded><![CDATA[<p>Visual Studio 2012 is absolutely the best IDE in the world and, with the latest version, it has sorted most of the big problems (from my point of view the previous version was a bit slow).</p>
<p>I&#8217;m not a big fan of extensions because they often make Visual Studio unstable and/or slow, but I&#8217;ll make an exception because it this case it&#8217;s incredibly cool!</p>
<h3><strong>Resharper 7</strong></h3>
<p>It doesn’t need presentation. It’s absolutely the best Add-On for Visual Studio (I use it probably from the first version);</p>
<p>Below a cool video by <a title="Hadi Hariri" href="http://hadihariri.com/" target="_blank">Hadi Hariri</a></p>
<p><object id="_fp_0.8801377154886723" width="560" height="315" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" name="player"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /><param name="quality" value="high" /><param name="flashvars" value="config=%7B%22plugins%22%3A%7B%22viral%22%3A%7B%22share%22%3Afalse%2C%22email%22%3Afalse%2C%22callType%22%3A%22default%22%2C%22url%22%3A%22http%3A//tv.jetbrains.net/flowplayer/flowplayer.viralvideos-3.2.9.swf%22%7D%2C%22dock%22%3A%7B%22horizontal%22%3Afalse%2C%22autoHide%22%3Atrue%2C%22right%22%3A15%2C%22width%22%3A%227pct%22%7D%2C%22controls%22%3A%7B%22stop%22%3Atrue%2C%22callType%22%3A%22default%22%2C%22backgroundColor%22%3A%22%23000000%22%2C%22url%22%3A%22http%3A//tv.jetbrains.net/flowplayer/flowplayer.controls-3.2.8.swf%22%7D%7D%2C%22clip%22%3A%7B%22pageUrl%22%3A%22http%3A//tv.jetbrains.net/videocontent/why-resharper-is-awesome%22%2C%22autoBuffering%22%3Atrue%2C%22url%22%3A%22http%3A//tv.jetbrains.net/sites/default/files/videos/converted/Overview.mp4%22%2C%22baseUrl%22%3A%22http%3A//tv.jetbrains.net%22%2C%22scaling%22%3A%22orig%22%2C%22autoPlay%22%3Afalse%7D%2C%22playlist%22%3A%5B%7B%22baseUrl%22%3A%22http%3A//tv.jetbrains.net%22%2C%22autoBuffering%22%3Atrue%2C%22scaling%22%3A%22orig%22%2C%22autoPlay%22%3Afalse%2C%22url%22%3A%22http%3A//tv.jetbrains.net/sites/default/files/videos/converted/Overview.mp4%22%7D%5D%7D" /><param name="src" value="http://tv.jetbrains.net/flowplayer/flowplayer-3.2.10.swf" /><embed id="_fp_0.8801377154886723" width="560" height="315" type="application/x-shockwave-flash" src="http://tv.jetbrains.net/flowplayer/flowplayer-3.2.10.swf" allowfullscreen="true" allowscriptaccess="always" wmode="transparent" quality="high" flashvars="config=%7B%22plugins%22%3A%7B%22viral%22%3A%7B%22share%22%3Afalse%2C%22email%22%3Afalse%2C%22callType%22%3A%22default%22%2C%22url%22%3A%22http%3A//tv.jetbrains.net/flowplayer/flowplayer.viralvideos-3.2.9.swf%22%7D%2C%22dock%22%3A%7B%22horizontal%22%3Afalse%2C%22autoHide%22%3Atrue%2C%22right%22%3A15%2C%22width%22%3A%227pct%22%7D%2C%22controls%22%3A%7B%22stop%22%3Atrue%2C%22callType%22%3A%22default%22%2C%22backgroundColor%22%3A%22%23000000%22%2C%22url%22%3A%22http%3A//tv.jetbrains.net/flowplayer/flowplayer.controls-3.2.8.swf%22%7D%7D%2C%22clip%22%3A%7B%22pageUrl%22%3A%22http%3A//tv.jetbrains.net/videocontent/why-resharper-is-awesome%22%2C%22autoBuffering%22%3Atrue%2C%22url%22%3A%22http%3A//tv.jetbrains.net/sites/default/files/videos/converted/Overview.mp4%22%2C%22baseUrl%22%3A%22http%3A//tv.jetbrains.net%22%2C%22scaling%22%3A%22orig%22%2C%22autoPlay%22%3Afalse%7D%2C%22playlist%22%3A%5B%7B%22baseUrl%22%3A%22http%3A//tv.jetbrains.net%22%2C%22autoBuffering%22%3Atrue%2C%22scaling%22%3A%22orig%22%2C%22autoPlay%22%3Afalse%2C%22url%22%3A%22http%3A//tv.jetbrains.net/sites/default/files/videos/converted/Overview.mp4%22%7D%5D%7D" name="player" /></object></p>
<p><strong>More info</strong>: <a href="http://www.jetbrains.com/resharper/">http://www.jetbrains.com/resharper/</a><br />
<strong>Download</strong>: <a href="http://www.jetbrains.com/resharper/download/index.html">http://www.jetbrains.com/resharper/download/index.html<br />
</a><strong>Cost</strong>: Free for opensource and MVP, 47€$ academic, 189€ Personal License, 332€ Commercial (+VAT for all licenses)</p>
<h3><strong>Vs Commands</strong></h3>
<p>Like Resharper I really love it because introduces some interesting features like <strong>Settings Synchronization</strong> (using DropBox, Skydrive or whatever you want). Moreover it <strong>highlights important messages in Output Windows</strong> (red for errors, yellow for warning, etc.), <strong>shows branc</strong>h name into the solution, <strong>locate in solution</strong> and my favorite feature : <strong>Attacch To IIS Process</strong>.</p>
<p>If you need to debug your web application, a simple click on a button (or a shortcut if you prefer) and you got the IIS process attached into Visual Studio.</p>
<p><strong>More info</strong>: <a href="http://vscommands.squaredinfinity.com/features">http://vscommands.squaredinfinity.com/features<br />
</a><strong>Download</strong>: <a href="http://visualstudiogallery.msdn.microsoft.com/a83505c6-77b3-44a6-b53b-73d77cba84c8">http://visualstudiogallery.msdn.microsoft.com/a83505c6-77b3-44a6-b53b-73d77cba84c8<br />
</a><strong>Cost</strong>: Free</p>
<h3><strong>StyleCop</strong></h3>
<p>It&#8217;s a incredible tool that improves your code quality. In fact, combined with R#, it analyzes C# source code to enforce a set of style and consistency rules (naming convention, code documentation, maintainability, spacing, etc.). If you don&#8217;t use R# you can use also StyleCop inside Visual Studio or jut at compile time with MsBuild.</p>
<p><strong>More info</strong>: <a href="http://stylecop.codeplex.com/">http://stylecop.codeplex.com/</a><a href="http://vscommands.squaredinfinity.com/features"><br />
</a><strong>Download</strong>: <a href="http://stylecop.codeplex.com/releases/view/79972">http://stylecop.codeplex.com/releases/view/79972</a><a href="http://visualstudiogallery.msdn.microsoft.com/a83505c6-77b3-44a6-b53b-73d77cba84c8"><br />
</a><strong>Cost</strong>: Free</p>
<h3><strong>Ghost Doc</strong></h3>
<p>It’s a cool extensions that helps you to document your methods starting from naming convention or copying from base method.<br />
Unluckily there isn’t yet a stable version for VS2012 but I’m using the beta and it seems to work well.</p>
<p><iframe src="http://www.youtube.com/embed/4aA4VZoVDQw" frameborder="0" width="560" height="315"></iframe></p>
<p><strong>More info</strong>: <a href="http://submain.com/products/ghostdoc.aspx">http://submain.com/products/ghostdoc.aspx</a><a href="http://vscommands.squaredinfinity.com/features"><br />
</a><strong>Download</strong>: <a href="http://submain.com/blog/GhostDocV4Beta2IsAvailable.aspx">http://submain.com/blog/GhostDocV4Beta2IsAvailable.aspx</a><a href="http://visualstudiogallery.msdn.microsoft.com/a83505c6-77b3-44a6-b53b-73d77cba84c8"><br />
</a><strong>Cost</strong>: Free for the basic version and from 25% to 50$ for the Pro</p>
<h3><strong>Image Optimizer</strong></h3>
<p>It’s a cool extension made by Mads Kristensen (<a href="http://madskristensen.net/">http://madskristensen.net/</a>) that optimizes your images directly inside Visual Studio. <strong>Right click on the folder or on the image and “Optimize Image”</strong>. You can see the compression result into the output window of Visual Studio.</p>
<p><iframe src="http://player.vimeo.com/video/17202901" frameborder="0" width="500" height="331"></iframe></p>
<p><strong><strong>More info and </strong>Download</strong>: <a href="http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3">http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3<br />
</a><strong>Cost</strong>: Free</p>
<h3><strong>SlowCheetah &#8211; XML Transforms</strong></h3>
<p>Is another interesting extension. It adds xml t<strong>ransformation for all xml files (not just for .config)</strong> and, only for the client application, <strong>applies the transformation</strong> directly when you <strong>push F5 from Visual Studio</strong>.</p>
<p><strong><strong>More info and </strong>Download</strong>: <a href="http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/view/Discussions/1">http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/view/Discussions/1</a><a href="http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3"><br />
</a><strong>Cost</strong>: Free</p>
<h3><strong>Web Essentials 2012</strong></h3>
<p>I’m not a web designer and I’m absolutely away to be a guru of CSS but that extension is really cool. Something I’ve to change a css color, class, or add a fallback for and old browser or a new no-standard feature (webkit, moz, prefixes for example).</p>
<p><object width="350" height="300" classid="clsid:dfeaf541-f3e1-4c24-acac-99c30715084a"><param name="source" value="http://visualstudiogallery.msdn.microsoft.com/Content/Common/videoplayer.xap" /><param name="initParams" value="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80261/1/vendor specific sync.wmv,autostart=false,autohide=true,showembed=true, postid=0" /><param name="background" value="#00FFFFFF" /><param name="src" value="data:application/x-silverlight-2," /><param name="initparams" value="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80261/1/vendor specific sync.wmv,autostart=false,autohide=true,showembed=true, postid=0" /><embed width="350" height="300" type="application/x-silverlight-2" src="data:application/x-silverlight-2," source="http://visualstudiogallery.msdn.microsoft.com/Content/Common/videoplayer.xap" initParams="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80261/1/vendor specific sync.wmv,autostart=false,autohide=true,showembed=true, postid=0" background="#00FFFFFF" initparams="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80261/1/vendor specific sync.wmv,autostart=false,autohide=true,showembed=true, postid=0" /><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img class="colorbox-703"  src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a></object></p>
<p><object width="350" height="300" classid="clsid:dfeaf541-f3e1-4c24-acac-99c30715084a"><param name="source" value="http://visualstudiogallery.msdn.microsoft.com/Content/Common/videoplayer.xap" /><param name="initParams" value="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80320/1/less.wmv,autostart=false,autohide=true,showembed=true, postid=0" /><param name="background" value="#00FFFFFF" /><param name="src" value="data:application/x-silverlight-2," /><param name="initparams" value="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80320/1/less.wmv,autostart=false,autohide=true,showembed=true, postid=0" /><embed width="350" height="300" type="application/x-silverlight-2" src="data:application/x-silverlight-2," source="http://visualstudiogallery.msdn.microsoft.com/Content/Common/videoplayer.xap" initParams="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80320/1/less.wmv,autostart=false,autohide=true,showembed=true, postid=0" background="#00FFFFFF" initparams="deferredLoad=true,duration=0,m=http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80320/1/less.wmv,autostart=false,autohide=true,showembed=true, postid=0" /><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img class="colorbox-703"  src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a></object></p>
<p><strong><strong>More info and </strong>Download</strong>: <a href="http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/">http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/</a><a href="http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3"><br />
</a><strong>Cost</strong>: Free</p>
<p>Which is your favorite?</p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/0SAY0a3iKwo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2012/08/22/my-favorite-extensions-for-visual-studio-2012/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
<enclosure url="http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80261/1/vendor" length="165232" type="application/wordperfect" />
<enclosure url="http://i1.visualstudiogallery.msdn.s-msft.com/07d54d12-7133-4e15-becb-6f451ea3bea6/image/file/80320/1/less.wmv" length="1993371" type="video/asf" />
		<feedburner:origLink>http://tostring.it/2012/08/22/my-favorite-extensions-for-visual-studio-2012/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=my-favorite-extensions-for-visual-studio-2012</feedburner:origLink></item>
		<item>
		<title>How integrate Facebook, Twitter, LinkedIn, Yahoo, Google and Microsoft Account with your ASP.NET MVC application</title>
		<link>http://feedproxy.google.com/~r/override/tostring/it/~3/_7NdDjuuy8Q/</link>
		<comments>http://tostring.it/2012/08/20/how-integrate-facebook-twitter-linkedin-yahoo-google-and-microsoft-account-with-your-asp-net-mvc-application/#comments</comments>
		<pubDate>Mon, 20 Aug 2012 14:10:11 +0000</pubDate>
		<dc:creator>imperugo</dc:creator>
				<category><![CDATA[aspnetmvc]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[microsoftclient]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://tostring.it/?p=687</guid>
		<description><![CDATA[How to connected the most popular social network like Facebook, Twitter, LinkedIn, Yahoo, Google, Microsoft with your ASP.NET Application. The new template makes that very easy ]]></description>
				<content:encoded><![CDATA[<p>In the past week, 15 august, Microsoft released an incredible number of cool stuff, starting from <strong>Windows 8</strong> and ending to <strong>Visual Studio 2012</strong> including the new <strong>ASP.NET Stack</strong>.</p>
<p>The version 4 of ASP.NET MVC introduces several cool features; most of them was available with the Beta and RC versions (Web API, Bundling, Mobile Projects Templates, etc.), but the <strong>RTM is not a “fixed version” of the RC</strong>, it has other interesting things.</p>
<p>After the installation, the first thing I noticed is a set of helpers inside the folder <strong>App_Start</strong>:</p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/001.png"><img class="aligncenter size-medium wp-image-689 colorbox-687" title="New helpers into MVC4 template" src="http://tostring.it/wp-content/uploads/2012/08/001-300x278.png" alt="" width="300" height="278" /></a></p>
<p>That makes the code much cleaner and maintainable, but it’s not enough J</p>
<p>From my point of view the most cool feature introduced with the RTM is the integration with the social network.</p>
<p>In the RTM, there are new packages in the default templates:</p>
<pre class="brush: xml; gutter: true">&lt;package id=&quot;DotNetOpenAuth.AspNet&quot; version=&quot;4.0.3.12153&quot; targetFramework=&quot;net45&quot; /&gt;
&lt;package id=&quot;DotNetOpenAuth.Core&quot; version=&quot;4.0.3.12153&quot; targetFramework=&quot;net45&quot; /&gt;
&lt;package id=&quot;DotNetOpenAuth.OAuth.Consumer&quot; version=&quot;4.0.3.12153&quot; targetFramework=&quot;net45&quot; /&gt;
&lt;package id=&quot;DotNetOpenAuth.OAuth.Core&quot; version=&quot;4.0.3.12153&quot; targetFramework=&quot;net45&quot; /&gt;
&lt;package id=&quot;DotNetOpenAuth.OpenId.Core&quot; version=&quot;4.0.3.12153&quot; targetFramework=&quot;net45&quot; /&gt;
&lt;package id=&quot;DotNetOpenAuth.OpenId.RelyingParty&quot; version=&quot;4.0.3.12153&quot; targetFramework=&quot;net45&quot; /&gt;</pre>
<p>These packages make simple the integration with the most social networks like <strong>Facebook</strong>, <strong>Twitter</strong>, <strong>LinkedIn</strong>, <strong>Yahoo</strong>, <strong>Google</strong> and <strong>Microsoft Client</strong>.</p>
<p>Obviously you can extend this with other providers but we’ll take a look in another post. Right now just testing the commons social.</p>
<p><strong>Facebook integration:</strong></p>
<p>First step for Facebook is retrieve the ConsumerKey and ConsumerSecret (it is based on oAuth 2.0), so register you application on <a href="https://developers.facebook.com/apps">https://developers.facebook.com/apps</a></p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/002.png"><img class="aligncenter size-medium wp-image-690 colorbox-687" title="Facebook app registration" src="http://tostring.it/wp-content/uploads/2012/08/002-300x194.png" alt="" width="300" height="194" /></a></p>
<p>Now, inside the method RegisterAuth into the class AuthConfig (App_Start/AuthConfig.cs), write that code:</p>
<pre class="brush: csharp; gutter: true">OAuthWebSecurity.RegisterFacebookClient(appId: &quot;yourAppId&quot;, appSecret: &quot;yourAppSecret&quot;);</pre>
<p><strong>Twitter integration:</strong></p>
<p>Twitter is based on oAuth 1.x and, exactly like Facebook, it needs the ConsumerKey and ConsumerSecret so, register your app here <a href="https://dev.twitter.com/">https://dev.twitter.com/</a></p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/003.jpg"><img class="aligncenter size-medium wp-image-691 colorbox-687" title="Twitter App registration" src="http://tostring.it/wp-content/uploads/2012/08/003-300x235.jpg" alt="" width="300" height="235" /></a></p>
<p>Now,  add this line of code into AuthConfig:</p>
<pre class="brush: csharp; gutter: true">OAuthWebSecurity.RegisterTwitterClient(consumerKey: &quot; yourConsumerKey&quot;, consumerSecret: &quot;yourConsumerSecret&quot;);</pre>
<p><strong>LinkedIn integration:</strong></p>
<p>As the previous socials, register your app here <a href="https://www.linkedin.com/secure/developer?newapp=">https://www.linkedin.com/secure/developer?newapp=</a></p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/004.jpg"><img class="aligncenter size-medium wp-image-692 colorbox-687" title="Linkedin App Registration" src="http://tostring.it/wp-content/uploads/2012/08/004-300x209.jpg" alt="" width="300" height="209" /></a></p>
<p>In AuthConfig add this:</p>
<pre class="brush: csharp; gutter: true">OAuthWebSecurity.RegisterLinkedInClient(&quot;yourKey&quot;, &quot;yourSecret&quot;);</pre>
<p><strong>Yahoo Integration:</strong></p>
<p>That is really simple, just add this line of code:</p>
<pre class="brush: csharp; gutter: true">OAuthWebSecurity.RegisterYahooClient();</pre>
<p>into AuthConfig</p>
<p><strong>Google Integration:</strong></p>
<p>Like Yahoo, Google integration doesn’t require any key or secret, so just add this:</p>
<pre class="brush: csharp; gutter: true">OAuthWebSecurity.RegisterGoogleClient();</pre>
<p>in AuthConfig.cs</p>
<p><strong>Microsot Account (formely known as Live ID):</strong></p>
<p>It is based on oAuth, so you need to register your application here <a href="https://manage.dev.live.com/AddApplication.aspx">https://manage.dev.live.com/AddApplication.aspx</a> (not so easy to find the url <img src='http://tostring.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley colorbox-687' /> )</p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/005.jpg"><img class="aligncenter size-medium wp-image-693 colorbox-687" title="Microsoft Account Application Registration" src="http://tostring.it/wp-content/uploads/2012/08/005-300x176.jpg" alt="" width="300" height="176" /></a></p>
<p>Into AuthConfig add this:</p>
<pre class="brush: csharp; gutter: true">OAuthWebSecurity.RegisterMicrosoftClient(clientId: “yourClientId”,clientSecret: “yourClientSecret”);</pre>
<p><strong>Start the application.<br />
</strong>Now, all your social networks are registered, so you just need to run the application and test it.<br />
Push F5 and everything should work automatically.</p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/007.jpg"><img class="aligncenter size-medium wp-image-694 colorbox-687" title="Default Template Screenshot - oAuth 001" src="http://tostring.it/wp-content/uploads/2012/08/007-300x181.jpg" alt="" width="300" height="181" /></a></p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/009.jpg"><img class="aligncenter size-medium wp-image-695 colorbox-687" title="Default Template Screenshot - oAuth 002" src="http://tostring.it/wp-content/uploads/2012/08/009-300x182.jpg" alt="" width="300" height="182" /></a></p>
<p><a href="http://tostring.it/wp-content/uploads/2012/08/010.jpg"><img class="aligncenter size-medium wp-image-696 colorbox-687" title="Default Template Screenshot - oAuth 003" src="http://tostring.it/wp-content/uploads/2012/08/010-300x181.jpg" alt="" width="300" height="181" /></a></p>
<p>Just few notes about the login page.</p>
<p>As you probably noticed we called a set of static method for the class <strong>OAuthWebSecurity</strong>. Each time we add a provider, the login page changes showing the available social.<br />
If you want to retrieve the list you just have to call the method <strong>OAuthWebSecurity.RegisteredClientData</strong> to obtain a collection of <strong>AuthenticationClientData</strong> with all information (<strong>provider name, authentication data, extra data and so on</strong>).</p>
<p>Is it cool?<br />
I think so. <strong>Stay tuned for other cool stuff about ASP.NET MVC 4</strong></p>
<img src="http://feeds.feedburner.com/~r/override/tostring/it/~4/_7NdDjuuy8Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://tostring.it/2012/08/20/how-integrate-facebook-twitter-linkedin-yahoo-google-and-microsoft-account-with-your-asp-net-mvc-application/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://tostring.it/2012/08/20/how-integrate-facebook-twitter-linkedin-yahoo-google-and-microsoft-account-with-your-asp-net-mvc-application/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-integrate-facebook-twitter-linkedin-yahoo-google-and-microsoft-account-with-your-asp-net-mvc-application</feedburner:origLink></item>
	</channel>
</rss>
