<rss version="2.0">
  <channel>
    <title>www.devjoker.com</title>
    <link>http://www.devjoker.com/asp/feeds.aspx</link>
    <description>www.devjoker.com Programacion .NET ASP.NET C# VB.NET SQL Server ORACLE</description>
    <item>
      <title>Herramientas para expresiones regulares</title>
      <link>http://www.devjoker.com/contenidos/articulos/541/Herramientas-para-expresiones-regulares.aspx</link>
      <description>&lt;p&gt;Las expresiones regulares son un dolor de cabeza, al menos para mí.&amp;nbsp; Aquí os dejo un par de herramientas que hacen mas llevadero el trabajo ellas.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_10.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; border-left: 0px; display: block; padding-right: 0px; margin-right: auto" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_thumb_4.png" width="242" height="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;h1&gt;txt2re&lt;/h1&gt; &lt;p&gt;Esta herramienta nos permite obtener una expresión regular a partir de una entrada de texto. &lt;/p&gt; &lt;p&gt;&lt;a href="http://txt2re.com/"&gt;http://txt2re.com/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_2.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; border-left: 0px; display: block; padding-right: 0px; margin-right: auto" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_thumb.png" width="244" height="208"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;El funcionamiento es sencillo, solo tenemos que introducir un texto y formar la expresión regular con el editor que sale en la página.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_4.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; border-left: 0px; display: block; padding-right: 0px; margin-right: auto" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_thumb_1.png" width="244" height="114"&gt;&lt;/a&gt;&lt;/p&gt; &lt;h1&gt;regex101&lt;/h1&gt; &lt;p&gt;Esta herramienta nos permite probar expresiones regulares de forma rápida. Además nos muestra una pequeñas explicación de cada una de las partes de nuestra expresión regular. (gracias a mi compañero &lt;a href="https://es.linkedin.com/pub/daniel-quijada-cuesta/1b/906/988"&gt;Daniel Quijada&lt;/a&gt; por este descubrimiento)&lt;/p&gt; &lt;p&gt;&lt;a href="https://regex101.com/"&gt;https://regex101.com/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_6.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; border-left: 0px; display: block; padding-right: 0px; margin-right: auto" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_thumb_2.png" width="244" height="137"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;p&gt;Hay muchas herramientas similares, pero lo que realmente diferencia a está es que posee una librería en la que podemos buscar expresiones regulares para cualquier cosa, además cada expresión regular está valorada por la comunidad para poder saber si funciona o no de forma rápida. Por último también tiene un chat. Imprescindible.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_8.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; border-left: 0px; display: block; padding-right: 0px; margin-right: auto" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Herramientas-para-expresiones-regulares-_D54D/image_thumb_3.png" width="244" height="168"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Espero que os sean de utilidad,&lt;/p&gt; &lt;p&gt;Saludos, DJK&lt;/p&gt;</description>
    </item>
    <item>
      <title>Servicios WCF con AJAX y JSON.</title>
      <link>http://www.devjoker.com/contenidos/articulos/539/Servicios-WCF-con-AJAX-y-JSON.aspx</link>
      <description>&lt;p&gt;Un tema sencillo pero que aún mucho programadores desconocen o no saben bien como implementar es la forma de exponer un servicio WCF para ser ejecutado vía AJAX y devolviendo los datos en formato JSON. Vamos a ver un ejemplo de como hacerlo, utilizando un servicio simple de WCF y jQuery desde una página HTML.&lt;/p&gt; &lt;p&gt;Lo primero que debemos hacer es crear un nuevo servicio, desde la plantilla “WCF Service with AJAX enabled”.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_2.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_thumb.png" width="244" height="159"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Al seleccionar este tipo de plantilla se crean los ficheros del servicio (*.svc y *.svc.cs) y el archivo de configuración, web.config. También añadiremos a nuestro proyecto una página simple HTML para probar el servicio (el contenido de todos estos ficheros los veremos más adelante).&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_10.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_thumb_4.png" width="244" height="176"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Es importante destacar que en el archivo de configuración se crea un endpoint a nuestro servicio y un comportamiento (behaviour) que permitirá su ejecución con AJAX, esto se indica con &lt;strong&gt;&lt;em&gt;enableWebScript.&lt;/em&gt;&lt;/strong&gt; Sin esta opción el servicio no permitirá su ejecución con AJAX.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behavior &lt;/span&gt;&lt;span style="background: white; color: red"&gt;name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;WebApplication1.MyServiceSampeAspNetAjaxBehavior&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &lt;strong&gt;&amp;lt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;&lt;strong&gt;enableWebScript &lt;/strong&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&lt;strong&gt;/&amp;gt;&lt;/strong&gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behavior&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;serviceHostingEnvironment &lt;/span&gt;&lt;span style="background: white; color: red"&gt;aspNetCompatibilityEnabled&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"
        &lt;/span&gt;&lt;span style="background: white; color: red"&gt;multipleSiteBindingsEnabled&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;/&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;services&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;service &lt;/span&gt;&lt;span style="background: white; color: red"&gt;name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;WebApplication1.MyServiceSampe&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;endpoint &lt;/span&gt;&lt;span style="background: white; color: red"&gt;address&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;behaviorConfiguration&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;WebApplication1.MyServiceSampeAspNetAjaxBehavior&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"
                &lt;/span&gt;&lt;span style="background: white; color: red"&gt;binding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;webHttpBinding&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;contract&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;WebApplication1.MyServiceSampe&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;service&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;services&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Ahora creamos el servicio, que es extremadamente simple: tan solo un método en el que devolvemos una nueva instancia de la clase &lt;em&gt;Foo. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Un aspecto a destacar es que utilizamos la configuración simplificada de WCF por lo que no es necesario tener una interfaz adicional sobre el servicio.&lt;/p&gt;
&lt;p&gt;El código también incluye la clase &lt;em&gt;Foo – que es el tipo de dato que queremos devolver en JSON - &lt;/em&gt;, recordad que es necesario decorar la clase con los atributos &lt;em&gt;DataContract&lt;/em&gt; y &lt;em&gt;DataMember&lt;/em&gt;.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Runtime.Serialization;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.ServiceModel;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.ServiceModel.Activation;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;WebApplication1
{
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ServiceContract&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;AspNetCompatibilityRequirements&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(RequirementsMode = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;AspNetCompatibilityRequirementsMode&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Allowed)]
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;MyServiceSampe
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{        
        [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;OperationContract&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo &lt;/span&gt;&lt;span style="background: white; color: black"&gt;GetFoo()
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo&lt;/span&gt;&lt;span style="background: white; color: black"&gt;() { Id = Guid.NewGuid(), Name= &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"devjoker"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, Surname=&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"devjoker.com" &lt;/span&gt;&lt;span style="background: white; color: black"&gt;};
        }        
    }

    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataContract&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataMember&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Guid Id { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataMember&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataMember&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Surname { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
    }

}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;En la página de prueba que hemos creado, añadimos una referencia a jQuery y realizamos la llamada al servicio. El callback de dicha llamada recibe los datos obtenidos del servicio y los muestra en pantalla.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;DOCTYPE &lt;/span&gt;&lt;span style="background: white; color: red"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;&amp;lt;!--ServiceClientPage.html--&amp;gt;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;head&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;script &lt;/span&gt;&lt;span style="background: white; color: red"&gt;src&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://code.jquery.com/jquery-1.9.1.min.js"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;script&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;meta &lt;/span&gt;&lt;span style="background: white; color: red"&gt;charset&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="utf-8"&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;devjoker.com&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;script&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
      &lt;/span&gt;&lt;span style="background: white; color: black"&gt;$(document).ready(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
          $.post(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"MyServiceSampe.svc/GetFoo"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(response) {
              &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;foo = response.d;
              $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_id"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Id);
              $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Name);
              $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_surname"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Surname);
          });
      });

  &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;script&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;head&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;body&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h1&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Service Client Sample&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h1&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h2&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;www.devjoker.com&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h2&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="content"&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;input &lt;/span&gt;&lt;span style="background: white; color: red"&gt;type&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="text" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="foo_id"/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;input &lt;/span&gt;&lt;span style="background: white; color: red"&gt;type&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="text" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="foo_name"/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;input &lt;/span&gt;&lt;span style="background: white; color: red"&gt;type&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="text" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="foo_surname"/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;body&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;La ejecución de la página tiene el siguiente aspecto, nada del otro mundo!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_8.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_thumb_3.png" width="477" height="170"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Si nos fijamos en el código cliente, observamos que el resultado del servicio lo obtenemos a través de una propiedad “d” de la respuesta:&lt;/p&gt;
&lt;p&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;foo = response.d;&lt;br&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Por defecto, WCF devuelve los datos envueltos en un propiedad «d», este comportamiento es debido a una recomendación de seguridad, como se explica en &lt;a href="http://weblog.west-wind.com/posts/2007/Oct/04/WCF-and-JSON-Services"&gt;este enlace&lt;/a&gt;. Si analizamos el tráfico HTTP vemos claramente este comportamiento.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_4.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_thumb_1.png" width="480" height="155"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;No obstante, esto suele ser interpretado como un inconveniente por muchos desarrolladores. Por supuesto es posible devolver el resultado de forma plana modificando el archivo de configuración del siguiente modo:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behavior &lt;/span&gt;&lt;span style="background: white; color: red"&gt;name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;WebApplication1.MyServiceSampeAspNetAjaxBehavior&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;enableWebScript &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;/&amp;gt;
            &lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;webHttp &lt;/span&gt;&lt;span style="background: white; color: red"&gt;defaultOutgoingResponseFormat&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;Json&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;defaultBodyStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;WrappedRequest&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;/&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style="background: white; color: blue"&gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behavior&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;behaviors&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;&lt;font color="#000000"&gt;Nota: Es posible configurar el servicio del mismo modo, utilizando los atributos &lt;/font&gt;&lt;/em&gt;&lt;a href="http://msdn.microsoft.com/es-es/library/system.servicemodel.web.webinvokeattribute.aspx"&gt;&lt;em&gt;WebInvoke&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;font color="#000000"&gt; y &lt;/font&gt;&lt;/em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.web.webgetattribute.aspx"&gt;&lt;em&gt;WebGet&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;font color="#000000"&gt;, aunque personalmente prefiero este acercamiento desacoplado, ya que es posible modificar como envía y devuelve datos el servcio desde configuración.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Si modificamos el &lt;em&gt;web.config&lt;/em&gt; de este modo obtenemos la respuesta limpia.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_6.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_thumb_2.png" width="481" height="117"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Para que el ejemplo funcione debemos modificar también el código javascript cliente, ya no es necesario leer la propiedad «d»&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;$(document).ready(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
    $.post(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"MyServiceSampe.svc/GetFoo"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,  &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(response) {
&lt;strong&gt;&lt;em&gt;        &lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="background: white; color: green"&gt;// var foo = response.d
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style="background: white; color: black"&gt;&lt;strong&gt;&lt;em&gt;foo = response;&lt;/em&gt;&lt;/strong&gt;
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_id"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Id);
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Name);
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_surname"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Surname);
    });
});&lt;/span&gt;&lt;/pre&gt;
&lt;h2&gt;Enviar parámetros al servicio WCF&lt;/h2&gt;
&lt;p&gt;Ahora vamos a ver otro ejemplo, esta vez enviado parámetros al servicio. Lo primero añadimos un nuevo método al servicio, en el que enviamos dos parámetros.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;[&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;OperationContract&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]        
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo &lt;/span&gt;&lt;span style="background: white; color: black"&gt;BuildFoo(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;surname)
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo&lt;/span&gt;&lt;span style="background: white; color: black"&gt;() { Id = Guid.NewGuid(), Name = name, Surname = surname };
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;El código cliente para ejecutar el servicio es ligeramente mas complejo, aunque nada del otro mundo:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;$.ajax({
    url: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"MyServiceSampe.svc/BuildFoo"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    type: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"POST"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    data: &lt;strong&gt;JSON.stringify&lt;/strong&gt;( { name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"The name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, surname: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"The surname" &lt;/span&gt;&lt;span style="background: white; color: black"&gt;}),              
    contentType: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"application/json"
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;}, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(response) {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;foo = response;
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_id"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Id);
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Name);
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_surname"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Surname);
});&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Lo único destacable es el uso de &lt;em&gt;$.ajax&lt;/em&gt; y la función &lt;em&gt;JSON.stringify&lt;/em&gt; para el envío de los parámetros al servicio. No olvidemos especificar el contentType “application/json”.&lt;/p&gt;Por último, vamos a añadir otro método al servicio, está vez recibiendo como parámetro una clase .net &lt;em&gt;InputType&lt;/em&gt; .&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;[&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;OperationContract&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]        
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo &lt;/span&gt;&lt;span style="background: white; color: black"&gt;BuildFooFromType(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;InputType &lt;/span&gt;&lt;span style="background: white; color: black"&gt;input)
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo&lt;/span&gt;&lt;span style="background: white; color: black"&gt;() { Id = Guid.NewGuid(), Name = input.Name, Surname = input.Surname };
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Donde el parámetro “input” de entrada es la siguiente clase:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;InputType &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{    
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }    
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Surname { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Y la ejecución del lado cliente es muy similar al ejemplo anterior, pero debemos “envolver” los parámetros en una propiedad &lt;em&gt;input&lt;/em&gt;&amp;nbsp; (&lt;em&gt;debe coincidir con el nombre del parámetro en el servicio).&lt;/em&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;$.ajax({
    url: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"MyServiceSampe.svc/BuildFooFromType"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    type: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"POST"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    data:  &lt;strong&gt;JSON.stringify&lt;/strong&gt;({ &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"input"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;:{ Name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"The name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, Surname: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"The surname" &lt;/span&gt;&lt;span style="background: white; color: black"&gt;} }),              
    contentType: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"application/json"
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;},
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(response) {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;foo = response;
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_id"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Id);
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Name);
        $(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"#foo_surname"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).val(foo.Surname);
});&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Si analizamos el tráfico HTTP vemos la ejecución y respuesta del servicio en JSON.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_12.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ServiciosWCFenJSON_AAD6/image_thumb_5.png" width="354" height="163"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Bueno, espero que este articulo os haya resultado interesante y haya aclarado algunas dudas sobre la forma de trabajar con WCF, AJAX y JSON.&lt;/p&gt;
&lt;p&gt;Saludos y hasta la próxima. DJK&lt;/p&gt;</description>
    </item>
    <item>
      <title>IT Books. Libros gratuitos para descarga</title>
      <link>http://www.devjoker.com/contenidos/articulos/538/IT-Books-Libros-gratuitos-para-descarga.aspx</link>
      <description>&lt;p&gt;Un post cortito, solo compartir con vosotros el siguiente site: &lt;a href="http://it-ebooks.info/"&gt;http://it-ebooks.info&lt;/a&gt; , un excelente recurso donde podemos encontrar todo tipo de libros de programación e informática.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ITBooks.Librosgratuitosparadescarga_14096/image_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; float: none; margin-left: auto; display: block; border-top-width: 0px; margin-right: auto" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/ITBooks.Librosgratuitosparadescarga_14096/image_thumb.png" width="560" height="396"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Muy recomendable.&lt;/p&gt; &lt;p&gt;Saludos, DJK&lt;/p&gt;</description>
    </item>
    <item>
      <title>Cambiar el idioma teclado con los nuevos Windows 8 y Windows 2012.</title>
      <link>http://www.devjoker.com/contenidos/articulos/537/Cambiar-el-idioma-teclado-con-los-nuevos-Windows-8-y-Windows-2012.aspx</link>
      <description>&lt;p&gt;Por si alguien tiene problemas para encontrar donde cambiar el teclado en Windows 2012 o Windows 8 (algo que suele suceder cuando te conectas por escritorio remoto a un equipo en otro país) os incluyo un video que he grabado para un cliente&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt; &lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:47bce8bb-f510-4ac0-8c1d-a2cac331539e" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt;&lt;div&gt;&lt;object width="448" height="252"&gt;&lt;param name="movie" value="http://www.youtube.com/v/D1rz9bHfHng?hl=en&amp;amp;hd=1"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/D1rz9bHfHng?hl=en&amp;amp;hd=1" type="application/x-shockwave-flash" width="448" height="252"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Como digo en el video parece una tontería pero yo he tardado un rato en encontrarlo.&lt;/p&gt;</description>
    </item>
    <item>
      <title>No te olvides de poner el Where en el Delete From (Una canción para programadores)</title>
      <link>http://www.devjoker.com/contenidos/articulos/536/No-te-olvides-de-poner-el-Where-en-el-Delete-From-Una-cancion-para-programadores.aspx</link>
      <description>&lt;p&gt;No sé si es de los creadores de “&lt;a href="http://www.devjoker.com/contenidos/catss/435/Tocame-el-windows.aspx"&gt;Tocame el windows&lt;/a&gt;” o no, pero estamos ante otro de esos WTF que van a pasar a la historia como una de la mayores frikadas jamas vistas!.&lt;/p&gt; &lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt; &lt;p align="center"&gt;&lt;iframe height="390" src="//www.youtube.com/embed/i_cVJgIz_Cs" frameborder="0" width="640" allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;p&gt;Sin palabras!&lt;/p&gt; &lt;p&gt;Visto en &lt;a href="https://www.facebook.com/kunfCode?hc_location=stream"&gt;&lt;font color="#0066cc"&gt;https://www.facebook.com/kunfCode&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Safari, Ajax y autenticación Windows. No se envían lo datos del POST.</title>
      <link>http://www.devjoker.com/contenidos/articulos/535/Safari-Ajax-y-autenticacion-Windows-No-se-envian-lo-datos-del-POST.aspx</link>
      <description>&lt;p&gt;Esta semana he estado liado con un problema que me ha estado volviendo loco. La aplicación con la que trabajo hace uso intensivo de jQuery y Ajax, y funciona bastante bien (modesto que soy :-)) en todos los navegadores modernos. ¿Todos? No! Una aldea poblada por … en Safari no. &lt;/p&gt; &lt;p&gt;En Safari, tanto en su versión de windows como iPAD la página provocaba un error en el servidor. Tras depurar la aplicación encontré que el problema era que no se están enviado los datos del POST, por lo que inicialmente pensé en un problema del lado del cliente, algún error de javascript y jQuery, así que lo primero que hice fue probar la aplicación y analizar el tráfico con &lt;a href="http://fiddler2.com/"&gt;Fiddler&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Mi sorpresa llego cuando la aplicación funciono sin problema … apague Fiddler y volvió a fallar. El caso es que tras volverme medio loco encontré este hilo de stackoverflow y me dio la solución:&lt;a style="white-space: normal; text-transform: none; word-spacing: 0px; color: rgb(17,85,204); font: small arial; letter-spacing: normal; text-indent: 0px; -webkit-text-stroke-width: 0px" href="http://stackoverflow.com/questions/7613196/ajax-post-request-only-works-once-in-safari-5" target="_blank"&gt;http://stackoverflow.com/&lt;wbr&gt;questions/7613196/ajax-post-&lt;wbr&gt;request-only-works-once-in-&lt;wbr&gt;safari-5&lt;/a&gt;, en el se puede ver la respuesta correcta.&lt;/p&gt; &lt;blockquote&gt; &lt;p style="border-top: 0px; border-right: 0px; vertical-align: baseline; white-space: normal; border-bottom: 0px; text-transform: none; word-spacing: 0px; color: rgb(0,0,0); padding-bottom: 0px; text-align: left; padding-top: 0px; font: 14px/18px arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; padding-left: 0px; clear: both; margin: 0px 0px 1em; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"&gt;&lt;em&gt;The reason the call is failing is because of a &lt;strong&gt;bug in Safari&lt;/strong&gt; when working with Windows Authentication under IIS. Go to the Authentication settings of your website. Right click on Windows Authentication, choose providers and remove Negotiate, leaving NTLM which works fine. I haven't tested Kerberos.&lt;/em&gt;&lt;/p&gt; &lt;p style="border-top: 0px; border-right: 0px; vertical-align: baseline; white-space: normal; border-bottom: 0px; text-transform: none; word-spacing: 0px; color: rgb(0,0,0); padding-bottom: 0px; text-align: left; padding-top: 0px; font: 14px/18px arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; padding-left: 0px; clear: both; margin: 0px 0px 1em; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"&gt;&lt;em&gt;&lt;strong&gt;This issue only appears in certain builds of safari&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Como vemos se trata de un bug de Safari. En el se describe perfectamente mi problema:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Envío de datos POST con Ajax &lt;/li&gt; &lt;li&gt;Aplicación con autenticación Windows sobre IIS.&lt;/li&gt; &lt;li&gt;Safari&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Lo gracioso del tema es que se indica que solo ocurre con algunos de los builds del producto … Y para lo que os esteis preguntando porque funciono cuando trabaje con Fiddler decir que Fiddler se pone como proxy, siendo finalmente Fiddler (y no Safari) el que envía las peticiones al IIS.&lt;/p&gt; &lt;p&gt;Para solucionarlo debemos abrir la consola de administración de IIS, seleccionar nuestro site web e ir a la opción de autenticación.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/SafariAjaxyautenticacinWindows.Noseenva_1124C/image_2.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/SafariAjaxyautenticacinWindows.Noseenva_1124C/image_thumb.png" width="521" height="379"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Abrimos el elemento y nos muestra las distintas opciones de autenticación disponibles, seleccionamos &lt;em&gt;Autenticación de Windows&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/SafariAjaxyautenticacinWindows.Noseenva_1124C/image_8.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/SafariAjaxyautenticacinWindows.Noseenva_1124C/image_thumb_3.png" width="526" height="359"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;De ahí seleccionamos proveedores y eliminamos Negotiate, dejando únicamente NTLM como proveedor.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/SafariAjaxyautenticacinWindows.Noseenva_1124C/image_6.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/SafariAjaxyautenticacinWindows.Noseenva_1124C/image_thumb_2.png" width="244" height="201"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Y eliminamos Negotiate de la lista de proveedores. Mas información sobre el proveedor: &lt;a href="http://technet.microsoft.com/es-es/library/dd560645(v=ws.10).aspx"&gt;&lt;font color="#0066cc"&gt;http://technet.microsoft.com/es-es/library/dd560645(v=ws.10).aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Espero que esta entrada os resulte de ayuda.&lt;/p&gt; &lt;p&gt;Saludos y hasta la próxima.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test Unitario y ficheros. Adiós DeploymentItem</title>
      <link>http://www.devjoker.com/contenidos/articulos/534/Test-Unitario-y-ficheros-Adios-DeploymentItem.aspx</link>
      <description>&lt;p&gt;Trabajar en un proyecto de test unitario que requiera de ficheros es un suplicio, además de tremendamente engorroso. &lt;/p&gt; &lt;p&gt;Si nos remitimos a la documentación de Microsoft, &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute.aspx"&gt;&lt;font color="#0066cc"&gt;http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute.aspx&lt;/font&gt;&lt;/a&gt; , debemos decorar nuestro método de test con el atributo &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.common.deploymentitem.aspx"&gt;DeploymentItem&lt;/a&gt;, y configurar la información de la ruta de entrada y salida del fichero. Este proceso es necesario ya que los test se ejecutan en el contexto de programa host (&lt;em&gt;vstest.executionengine.exe&lt;/em&gt;)&lt;/p&gt; &lt;p&gt;Pero realmente esto no es suficiente, y para que realmente funcione debemos establecer varias propiedades a nivel del archivo (como &lt;em&gt;CopyToOutput true&lt;/em&gt;) y configurar el test para que admita el deployment de archivos. Cuando solo necesitamos uno o dos ficheros, puede pasar, pero cuando el número de test que requieren de ficheros aumenta se convierte en un autentico calvario.&lt;/p&gt; &lt;p&gt;Por si fuera poco, debemos incluir el código para leer el fichero en nuestro test, con lo que estamos añadiendo complejidad y posibles puntos de error (un test podría fallar al leer el fichero, y no en la condición de prueba).&lt;/p&gt; &lt;p&gt;Para rematar la faena, la complejidad aumenta si ejecutamos nuestros test en un servidor de integración continua como parte de una Build. Si buscamos un poco el panorama es desalentador …&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_6.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_thumb_2.png" width="452" height="355"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Afortunadamente existe un método muy sencillo que nos evita todo este jaleo, que es extremadamente simple y que además os lo voy a explicar ahora mismo! :-)&lt;/p&gt; &lt;p&gt;Es tan fácil como usar archivos, de recursos. Los archivos de recursos permiten incluir archivos como parte de sus componentes. Los ficheros adjuntos se almacenan fuera del archivo de recursos – lo que nos permite modificarlos de forma fácil desde el propio VisualStudio, y es el propio framework quien se encarga del resto. Además cuando accedamos al fichero lo haremos directamente a través de propiedades sin necesidad de tener que andar leyendolo.&lt;/p&gt; &lt;p&gt;Vamos a verlo con un sencillo ejemplo, Imaginemos un programa en el que tenemos la siguiente clase:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Persona    
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public static &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Persona &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Load(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlString) {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;document = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XDocument&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Parse(xmlString);            
            
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;persona = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Persona&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
        persona.Id = Guid.Parse(document.Root.Element(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Id"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).Value);
        persona.Name = document.Root.Element(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Name"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).Value;
        persona.SurName = document.Root.Element(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"SurName"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).Value;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;persona;
    }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Persona()
    {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Id = Guid.NewGuid();
    }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Guid Id { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;protected set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;SurName { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;       
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;La clase es muy sencilla, y solo tiene una serie de propiedades básicas. Le hemos añadido un método estático &lt;em&gt;Load&lt;/em&gt; que nos permite instanciar la clase desde un &lt;em&gt;string&lt;/em&gt; – ya sé que no es el mejor diseño, pero necesitaba un ejemplo válido para el articulo!!&lt;/p&gt;
&lt;p&gt;Ahora, en nuestro proyecto de test añadimos un fichero &lt;em&gt;Personal.xml&lt;/em&gt; con el siguiente contenido:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="background: white; color: red"&gt;version&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;1.0&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;encoding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&lt;/span&gt;&lt;span style="background: white; color: black"&gt;"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;utf-8&lt;/span&gt;&lt;span style="background: white; color: black"&gt;" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;persona&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;316F0DFC-CD03-458F-85BE-389B7E0E2D0C&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;www.devjoker.com&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;SurName&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Unit Test y archivos&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;SurName&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;persona&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Este fichero nos va a servir como entrada para el test del método &lt;em&gt;Load&lt;/em&gt; de la clase.&lt;/p&gt;
&lt;p&gt;Ahora tenemos que añadir un archivo de recursos a nuestro proyecto de test, al que llamamos &lt;em&gt;PersonaTestResources.resx&lt;/em&gt;. En un archivo de recursos podemos añadir el fichero simplemente modificando la vista a “Files” desde el combo de la esquina superior izquierda …&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_4.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_thumb_1.png" width="451" height="205"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Y añadir el archivo &lt;em&gt;Persona.xml&lt;/em&gt; al fichero de recursos arrastrandolo al interior de la vista de diseño.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/Snap%202013-10-10%20at%2000.30.21_2.png"&gt;&lt;img title="Snap 2013-10-10 at 00.30.21" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="Snap 2013-10-10 at 00.30.21" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/Snap%202013-10-10%20at%2000.30.21_thumb.png" width="455" height="316"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Y por fin el test:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Files &lt;/span&gt;&lt;span style="background: white; color: black"&gt;= TestSample.Test.Resources.&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PersonaTestResources&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
[&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;TestClass&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PersonaTest
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;TestMethod&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]        
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PersonaLoadTest() { 
        &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// arrange
            
        // act
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;persona = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Persona&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Load(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Files&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Persona);

        &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// assert
        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Assert&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.AreEqual(persona.Id.ToString(), &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"316F0DFC-CD03-458F-85BE-389B7E0E2D0C"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Assert&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.AreEqual(persona.Name, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"www.devjoker.com"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Assert&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.AreEqual(persona.SurName, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Unit Test y archivos"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
    }

}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Fijaros que hemos creado un alias &lt;em&gt;Files &lt;/em&gt;para nuestro fichero de recursos &lt;em&gt;- &lt;span style="color: blue"&gt;using&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af"&gt;Files&lt;/span&gt; = TestSample.Test.Resources.&lt;span style="color: #2b91af"&gt;PersonaTestResources&lt;/span&gt;; -&lt;/em&gt; , y podemos acceder al contenido del fichero simplemente accediendo a la propiedad de &lt;em&gt;Persona&lt;/em&gt;&amp;nbsp; (dado que nuestro archivo se llamaba &lt;em&gt;Persona.xml &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;Cuando el test se ejecuta podemos ver que dicha propiedad tiene el contenido del fichero:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_8.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_thumb_3.png" width="459" height="222"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Lo mejor de todo es que además nuestro test se ejecuta sin problemas en un servidor de builds.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_12.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testyficheros_ECF/image_thumb_5.png" width="461" height="111"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Este método es mucho más sencillo y fácil de mantener que el tradicional con el atributo DeploymentItem, asi que adios DeploymentItem … adios!&lt;/p&gt;
&lt;p&gt;Saludos y hasta la próxima!.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Estructura de una aplicación ASP.NET MVC</title>
      <link>http://www.devjoker.com/contenidos/articulos/533/Estructura-de-una-aplicacion-ASPNET-MVC.aspx</link>
      <description>&lt;h2&gt;Crear una aplicación ASP.NET MVC con Visual Studio&lt;/h2&gt; &lt;p&gt;&lt;span id="internal-source-marker_0.6746585617271245" style="font-size: 15px; font-family: arial; font-variant: normal; vertical-align: baseline; font-weight: normal; color: #000000; font-style: normal; text-decoration: none; background-color: transparent"&gt;Ya hemos visto los &lt;a href="http://www.devjoker.com/contenidos/catss/518/Fundamentos-de-funcionamiento-de-una-aplicacion-web.aspx"&gt;fundamentos de una aplicación web&lt;/a&gt; y una introducción al &lt;a href="http://www.devjoker.com/contenidos/catss/525/Patron-MVC-Modelo-Vista-Controlador.aspx"&gt;patrón MVC&lt;/a&gt;. Llegados a esto punto ya podemos crear nuestra aplicación web con ASP.NET MVC. Para ello, abrimos Visual Studio, y a través del menú seleccionamos “New Project”. En el caso de que no tengamos instalado Visual Studio podemos descargar la versión Express (gratuita) desde el siguiente enlace: &lt;a href="http://www.asp.net/mvc"&gt;&lt;font color="#0066cc"&gt;http://www.asp.net/mvc&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_14.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_5.png" width="427" height="258"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 15px; font-family: arial; font-variant: normal; vertical-align: baseline; font-weight: normal; color: #000000; font-style: normal; text-decoration: none; background-color: transparent"&gt;Para crear una aplicación ASP.NET MVC basta con seleccionar la opción adecuada dentro de la pantalla de &lt;em&gt;templates&lt;/em&gt; para Visual Studio. Seleccionamos ASP.NET MVC Web Applicattion. En el caso de que la opción no figure en al lista, es indicativo de que no hemos instalado ASP.NET MVC. Podemos realizar dicha descarga desde este enlace: &lt;a href="http://www.asp.net/mvc"&gt;http://www.asp.net/mvc&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 15px; font-family: arial; font-variant: normal; vertical-align: baseline; font-weight: normal; color: #000000; font-style: normal; text-decoration: none; background-color: transparent"&gt;&lt;/span&gt;&amp;nbsp;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_16.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_6.png" width="416" height="289"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;En el siguiente paso debemos seleccionar la plantilla del proyecto. Disponemos de tres plantillas:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Empty – Plantilla vacia.  &lt;li&gt;Internet Application – Plantilla de propósito general configurada con seguridad basada en formularios (la aplicación pedirá usuario y password al visitante para identificarse). Adecuada para aplicaciones de internet.  &lt;li&gt;Intranet Application - Plantilla de propósito general configurada con seguridad basada en Windows, integrada con el directorio activo (la aplicación utiliza el usuario de Windows que esta conectado). Adecuada para entornos de intranet.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;En nuestro caso seleccionamos “Internet Application”.&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_18.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_7.png" width="409" height="370"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Es importante destacar que en la parte inferior de esta pantalla es en la que seleccionamos el motor de renderizado de las vistas «View Engine» - seleccionamos RAZOR. En ASP.NET MVC las vistas son procesadas por un motor de renderizado antes de ser devueltas al cliente. Este motor es RAZOR. En este mismo tutorial veremos en detalle la sintaxis de RAZOR.&lt;/p&gt; &lt;p&gt;Además disponemos de un segundo motor de renderizado – ASPX, que emplea la misma sintaxis utilizada por Web Forms (basado en las marcas &amp;lt;% %&amp;gt;)&lt;/p&gt; &lt;p&gt;También podemos instalar motores adicionales, como el caso de &lt;strong&gt;NHAML&lt;/strong&gt; - &lt;a href="http://code.google.com/p/nhaml/"&gt;http://code.google.com/p/nhaml/&lt;/a&gt;, una implementación de .NET del popular motor de renderizado de &lt;strong&gt;&lt;em&gt;Ruby On Rails&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;En esta pantalla – &lt;em&gt;New ASP.NET MVC 4 Project &lt;/em&gt;-, seleccionamos además la casilla para crear un proyecto de «Testing» y el framework que deseamos utilizar para el mismo. Una de las ventajas que obtenemos al utilizar ASP.NET MVC es simplificar el proceso de test de nuestro código, algo importantísimo de cara a la calidad de nuestros desarrollos. Al final de este tutorial incluiremos un anexo sobre test unitario (mientras tanto os invito a la excelente introducción que realizo &lt;a href="http://geeks.ms/blogs/ilanda/"&gt;Ibon Landa&lt;/a&gt; en Geeks &lt;a href="http://geeks.ms/blogs/ilanda/archive/2009/06/16/pruebas-unitarias-resumiendo.aspx"&gt;http://geeks.ms/blogs/ilanda/archive/2009/06/16/pruebas-unitarias-resumiendo.aspx&lt;/a&gt;)&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Finalmente, pulsamos OK y Visual Studio creará el proyecto. &lt;/p&gt; &lt;p&gt;Al finalizar, debemos tener una solución de Visual Studio con una estructura como la siguiente:&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_20.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_8.png" width="400" height="638"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Como podemos ver la imagen anterior Visual Studio ha creado una solución con dos proyectos:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;MvcApplication1, se trata del proyecto web que contiene los archivos de nuestra aplicación web.  &lt;li&gt;MvcApplication1.Test, es el proyecto de testing asociado.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;A continuación vamos a explicar los diferente archivos y directorios que se han creado en el proyecto MvcApplication1, con el objetivo de entender la organización de ficheros y carpetas de ASP.NET MVC.&lt;/p&gt; &lt;p&gt;Profundizaremos en los diferentes conceptos según avancemos en el tutorial, se muestran aquí de manera introductoria para que nos vayamos familiarizando con la estructura de archivos y carpetas.&lt;/p&gt; &lt;h2&gt;Estructura de directorios y archivos.&lt;/h2&gt; &lt;p&gt;Cuando creamos una nueva aplicación con ASP.NET MVC se crea por defecto una estructura de directorios, apropiada para la gran mayoría de las aplicaciones. Por supuesto podemos añadir nuevos directorios a esta estructura, aunque por razones de coherencia recomendamos mantener la estructura que propone ASP.NET MVC. &lt;/p&gt; &lt;h3&gt;Directorio App_Data.&lt;/h3&gt; &lt;p&gt;Este directorio está pensado para ubicar archivos de datos, normalmente bases de datos MSSQL. También es el lugar adecuado para archivos XML o cualquier otra fuente de datos.&lt;/p&gt; &lt;p&gt;Inicialmente está vacio.&lt;/p&gt; &lt;h3&gt;Directorio App_Start.&lt;/h3&gt; &lt;p&gt;Este directorio, nuevo en ASP.NET MVC 4, contiene los archivos de código que se ejecutan al inicializar la aplicación. Como veremos mas adelante, todo aplicación ASP.NET MVC es una instancia derivada de la clase &lt;em&gt;System.Web.HttpApplication&lt;/em&gt;, definida en el archivo global.asax. Esta clase es la encargada de iniciar la aplicación, el directorio App_Start está pensando para ubicar las clases de configuración para el inicio de la aplicación.&lt;/p&gt; &lt;p&gt;La siguiente imagen muestra el contenido del directorio.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_31.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb.png" width="180" height="117"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Por defecto contiene los siguientes archivos(clases):&lt;/p&gt; &lt;ul&gt; &lt;li&gt;AuthConfig.cs  &lt;li&gt;BundleConfig.cs  &lt;li&gt;FilterConfig.cs  &lt;li&gt;RouteConfig.cs  &lt;li&gt;WebApiConfig.cs&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Directorio Content.&lt;/h3&gt; &lt;p&gt;El directorio Content está pensado para el contenido estático de la aplicación, especialmente útil para archivos css e imágenes asociadas.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_7.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_1.png" width="192" height="244"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;ASP.NET MVC nos ofrece por defecto una organización en base a “temas”, que nos permita personalizar el aspecto visual de nuestra aplicación de forma fácil y rápida (eso en teoría… elaborar un tema visual puede requerir de mucho trabajo y la colaboración de un diseñador gráfico, algo que recomiendo siempre que sea posible). &lt;/p&gt; &lt;p&gt;También es el lugar apropiado para los archivos .less en el caso de que utilicemos esta tecnología en nuestra aplicación.&lt;/p&gt; &lt;h3&gt;Directorio Controllers.&lt;/h3&gt; &lt;p&gt;El directorio controllers en el lugar para los controladores, que como hemos visto en el &lt;a href="http://www.devjoker.com/contenidos/catss/525/Patron-MVC-Modelo-Vista-Controlador.aspx"&gt;capitulo anterior&lt;/a&gt;&amp;nbsp; los controladores son las clases encargadas de recibir y gestionar las peticiones &lt;em&gt;http&lt;/em&gt; de la aplicación.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_9.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_2.png" width="210" height="62"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Veremos los controladores en profundidad mas adelante.&lt;/p&gt; &lt;h3&gt;Directorio Filters&lt;/h3&gt; &lt;p&gt;El directorio Filters es el lugar donde debemos ubicar los filtros. Los filtros son atributos (también llamados decoradores) para los controladores, que nos permiten aplicar un comportamiento previo y posterior a la ejecución de uno o varios métodos de los controladores. Son clases derivadas de System.Web.Mvc.ActionFilterAttribute. A través de este mecanismo podemos añadir fácilmente funcionalidad a nuestros controladores evitando repetir la misma lógica una y otra vez, sobrescribiendo el comportamiento de algunas acciones. &lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_11.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_3.png" width="244" height="39"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;La plantilla incluye un filtro de ejemplo, &lt;em&gt;InitializeSimpleMembership&lt;/em&gt;, en el siguiente ejemplo vemos como se utiliza el fitlro para decorar la clase &lt;em&gt;AccountController&lt;/em&gt; (también incluida en la plantilla de proyecto)&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;[&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Authorize&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;&lt;strong&gt;InitializeSimpleMembership&lt;/strong&gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&lt;strong&gt;]&lt;/strong&gt;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;AccountController &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Controller
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
    &lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
    // GET: /Account/Login

&lt;/span&gt;&lt;span style="background: white; color: black"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Veremos los filtros en profundidad mas adelante.&lt;/p&gt;
&lt;h3&gt;Directorio Images&lt;/h3&gt;
&lt;p&gt;Este es evidente … El directorio &lt;em&gt;images&lt;/em&gt; es lugar para la imágenes de nuestra aplicación. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_21.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_4.png" width="185" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Como observación diremos que en el caso de que las imágenes formen parte del aspecto visual del sitio web, y no del contenido, deberían estar en el directorio content, como parte de un tema.&lt;/p&gt;
&lt;p&gt;Por ejemplo, el contenido de una galería fotográfica o de un catalogo de productos debería estas en la carpeta &lt;em&gt;images&lt;/em&gt;, mientras que las imágenes de fondo, iconos de los botones, sprites, etc deberían estar en la carpeta &lt;em&gt;content&lt;/em&gt; junto con los archivos &lt;em&gt;css&lt;/em&gt;. Básicamente, si una imagen se utiliza en un archivo &lt;em&gt;css&lt;/em&gt; el lugar adecuado es la carpeta &lt;em&gt;content&lt;/em&gt;.&lt;/p&gt;
&lt;h3&gt;Directorio Models&lt;/h3&gt;
&lt;p&gt;El directorio models es la ubicación que nos propone ASP.NET MVC para las clases que representan el modelo de la aplicación, los datos que gestiona nuestra aplicación.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_23.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_9.png" width="241" height="116"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Nota. En aplicaciones complejas, divididas en capas las clases de modelo suelen incluirse en assemblie aparte. &lt;/p&gt;
&lt;p&gt;La siguiente clase muestra un ejemplo muy básico para representar el modelo de nuestra aplicación.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;FooModel
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Guid Id { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
}&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Una de las grandes ventajas de las que disponemos en ASP.NET es que podemos decorar la clase que representa la modelo con diferentes atributos, que nos van a permitir establecer reglar sobre los datos como por ejemplo las reglas de la validación, si el datos es requerido o no, la longitud máxima y mínima del dato … etc&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;FooModel
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Required&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]   
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Guid Id { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }

    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Required&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;StringLength&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(100, ErrorMessage = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"The {0} must be at least {2} characters long."&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, MinimumLength = 3)]    
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Display&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(Name = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Name for FooModel"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)]
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
}&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Como veremos cuando veamos las vistas, estos atributos son interpretados por la vista para establecer automáticamente las validaciones necesarias en función del los decoradores utilizados en el modelo.&lt;/p&gt;
&lt;h3&gt;Directorio Scripts&lt;/h3&gt;
&lt;p&gt;El directorio scripts está pensado para ubicar los archivos de javascript (*.js). El código javascript es ejecutado en el contexto del navegador, es decir, en la parte cliente, y nos permite ejecutar acciones sin necesidad de enviar los datos al servidor.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_25.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_10.png" width="209" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;ASP.NET MVC incluye varias librerias de javascript por defecto:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;jquery.js&lt;/strong&gt;. Esta popular y súper útil librería nos va a permitir gestionar fácilmente peticiones &lt;a href="http://www.devjoker.com/contenidos/C/387/Aprende-Ajax-desde-cero.aspx"&gt;AJAX&lt;/a&gt;, manipular el DOM en cliente, etc … Esta librería se ha convertido en un framework muy popular, y es la base de para la creación de &lt;a href="http://www.devjoker.com/contenidos/articulos/498/Interesante-recopilacioacuten-de-plugins-de-jQuery.aspx"&gt;pluggins&lt;/a&gt; que nos van a permitir dotar a nuestro sitio web de efecto sorprendentes sin apenas esfuerzo. &lt;a href="http://jquery.com/"&gt;&lt;font color="#0066cc"&gt;http://jquery.com/&lt;/font&gt;&lt;/a&gt; 
&lt;li&gt;&lt;strong&gt;jquery.spin.js&lt;/strong&gt;. Este pluggin nos permite crear animaciones de indicación de carga de contenidos &lt;em&gt;– &lt;/em&gt;el circulito que da vueltas para indicarnos que la página esta realizando algún proceso . Es un pluggin de jQuery basado en spin.js. &lt;a href="http://fgnass.github.io/spin.js/"&gt;&lt;font color="#0066cc"&gt;http://fgnass.github.io/spin.js/&lt;/font&gt;&lt;/a&gt; 
&lt;li&gt;&lt;strong&gt;jquery.validate.js&lt;/strong&gt;. Este pluggin nos permite realizar validaciones en el lado cliente fácilmente. Esta vinculado al uso de decoradores en el modelo de nuestra aplicación. 
&lt;li&gt;&lt;strong&gt;knockout.js&lt;/strong&gt;. Esta librería nos permite utilizar el patrón de diseño MVVM (Model View ViewModel), que introdujo Microsoft para el desarrollo con WPF y Silverlight en aplicaciones web con javascript. &lt;a href="http://knockoutjs.com/"&gt;http://knockoutjs.com/&lt;/a&gt; 
&lt;li&gt;&lt;strong&gt;modernizr.js&lt;/strong&gt;. Esta librería nos permite validar fácilmente si el navegador que esta ejecutando la página web es compatible con HTML5, en en caso de que no sea así proporcional un mecanismo alternativo (&lt;em&gt;polyfill&lt;/em&gt;). &lt;a href="http://modernizr.com/"&gt;http://modernizr.com/&lt;/a&gt;. Por ejemplo, si nuestro navegador es compatible con HTML5 interpretará sin problema la etiqueta &lt;em&gt;VIDEO&lt;/em&gt;, pero en el caso de que estemos navegando con un navegador antiguo deberemos ofrecer al usuario un mecanismo alternativo para el video (un flash por ejemplo). En el siguiente enlace podemos encontrar polyfills para casi todas las características de HTML5: &lt;a href="https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills"&gt;&lt;font color="#0066cc"&gt;https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Nota: El nombre de los archivos puede varias dependiendo de la versión instalada, por ejemplo el archivo jQuery.js se llama jquery-1.7.1.js, ya que corresponde con la versión 1.7.1 de la librería.&lt;/p&gt;
&lt;h3&gt;Directorio Views&lt;/h3&gt;
&lt;p&gt;El directorios &lt;em&gt;Views&lt;/em&gt; contiene los archivos de vista. Como explicamos en la introducción al patrón MVC los controladores devuelven vistas sobre las que inyectamos el modelo de nuestra aplicación. Estas vistas son interpretadas por el motor de renderización – &lt;em&gt;Razor&lt;/em&gt; en nuestro caso. Son archivos similares a aplicaciones de ASP clasico, donde tenemos código HTML estático y determinadas zonas de código que son ejecutadas en el servidor.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_27.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_11.png" width="188" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;El siguiente ejemplo muestra el clásico “Hola Mundo”.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@{
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;    Layout = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"~/Views/Shared/_Layout.cshtml"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
    ViewBag.Title = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"HelloWorld"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;}
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h2&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;HelloWorld&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h2&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@*&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;El código se servidor se especifica con el caracter @&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;*@&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Podemos asignar un modelo a la vista a través de la siguiente directiva.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@model &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1.Models.&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;FooModel&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Veremos las vistas en profundidad mas adelante.&lt;/p&gt;
&lt;h3&gt;Directorio Shared&lt;/h3&gt;
&lt;p&gt;El directorio Shared contiene vistas que van a ser reutilizadas en otras vistas. Veremos como incluir vistas - denominadas parciales – en otra vista cuando veamos Razor, aunque de manera muy breve diremos que se realiza a través del &lt;em&gt;Helper Html, &lt;/em&gt;de la siguiente forma:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.Partial(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Error"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;) &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@*&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;Incluye la vista parcial Error.cshtml, del directorio Shared&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;*@&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;En este caso es muy importante respetar la ubicación de los archivos, ya que cuando desde una vista hagamos la llamada @Html.Partial(“Error”) para incluir la vista de la pantalla de error, el motor buscara en el directorio Shared para encontrar la vista Error.cshtml.&lt;/p&gt;
&lt;p&gt;No debemos confundir una vista compartida con los controles .ascx de ASP.NET WebForms. Cuando incluimos vistas compartidas en otra vista, esta son interpretadas por RAZOR sin ejecutarse ningún controlador. Simplemente se renderiza su contenido – no como en los controles ascx donde se ejecuta todo el ciclo de vida del control completo y sus correspondientes eventos. &lt;/p&gt;
&lt;p&gt;Es posible utilizar una vistas compartida de un modo muy similar al de un control ascx de ASP.NET WebForms, aunque para este debemos forzar la ejecución del controlador a través de los métodos Action y RenderAction del &lt;em&gt;Helper Html&lt;/em&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.Action(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"About"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;) &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@*&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;Ejecuta el método "About" del controlador correspondiente&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;*@&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;h3&gt;Archivo _ViewStart.cshtml&lt;/h3&gt;
&lt;p&gt;Este archivo establece el layout por defecto de las páginas. El contenido del archivo es sencillo y únicamente especifica el archivo de layout.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@{
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;    Layout = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"~/Views/Shared/_Layout.cshtml"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;El layout es un archivo con extension .cshtml que contiene la estructura general de documento, que es reutilizada en el resto de vistas. De este modo evitamos tener que reescribir el código en todas las vistas, reutilizando el código y permitiendo que este sea mucho mas sencillo de mantener.&lt;/p&gt;
&lt;p&gt;En cierto modo es similar a las &lt;em&gt;MasterPages&lt;/em&gt; de ASP.NET WebForms.&lt;/p&gt;
&lt;h3&gt;Archivo _Layout.cshtml&lt;/h3&gt;
&lt;p&gt;El archivo _Layout.cshtml define el&amp;nbsp; layout de la aplicación, que contiene la estructura general de documento, que es reutilizada en el resto de vistas. El archivo _Layout.cshtml se encuentra dentro del directorio Views/Shared. El contenido del archivo layout por defecto se muestra a continuación:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;DOCTYPE &lt;/span&gt;&lt;span style="background: white; color: red"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;html &lt;/span&gt;&lt;span style="background: white; color: red"&gt;lang&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="en"&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;head&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;meta &lt;/span&gt;&lt;span style="background: white; color: red"&gt;charset&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="utf-8" /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;ViewBag.Title - My ASP.NET MVC Application&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;link &lt;/span&gt;&lt;span style="background: white; color: red"&gt;href&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="~/favicon.ico" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;rel&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="shortcut icon" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;type&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="image/x-icon" /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;meta &lt;/span&gt;&lt;span style="background: white; color: red"&gt;name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="viewport" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;content&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="width=device-width" /&amp;gt;
        &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Styles&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Render(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"~/Content/css"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
        &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Scripts&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Render(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"~/bundles/modernizr"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
        
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;head&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;body&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="content-wrapper"&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="float-left"&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;p &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="site-title"&amp;gt;&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.ActionLink(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"your logo here"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Index"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Home"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;p&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="float-right"&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;section &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="login"&amp;gt;
                        &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.Partial(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"_LoginPartial"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;section&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;nav&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;ul &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="menu"&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;li&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.ActionLink(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Home"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Index"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Home"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;li&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;li&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.ActionLink(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"About"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"About"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Home"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;li&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;li&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.ActionLink(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Contact"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Contact"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Home"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;li&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;ul&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;nav&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="body"&amp;gt;
            &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;RenderSection(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"featured"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, required: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;false&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;section &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="content-wrapper main-content clear-fix"&amp;gt;
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;RenderBody()
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;section&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;footer&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="content-wrapper"&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div &lt;/span&gt;&lt;span style="background: white; color: red"&gt;class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="float-left"&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;p&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: red"&gt;&amp;amp;copy; &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;DateTime.Now.Year - My ASP.NET MVC Application&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;p&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;footer&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

        &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Scripts&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Render(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"~/bundles/jquery"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
        &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;RenderSection(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"scripts"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, required: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;false&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;body&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Fijemonos en la llamada que hace Razor al método @RenderBody(), es ahí donde se procesará la vista que estemos mostrando.&lt;/p&gt;
&lt;p&gt;Podemos tener múltiples archivos de layout dentro de nuestro proyecto.&lt;/p&gt;
&lt;h3&gt;El archivo web.config&lt;/h3&gt;
&lt;p&gt;El archivo web.config es el archivo principal de configuración de ASP.NET. Se trata de un archivo XML donde se define la configuración de la aplicación. Veremos poco a poco el contenido de este fichero, aunque vamos a ver aquí algunas características generales que es necesario conocer.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_29.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_12.png" width="188" height="64"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Para simplificar el despliegue de las aplicaciones, el archivo de configuración se presenta en diferentes versiones o “sabores”, de forma que podemos modificar el archivo de configuración dependiendo de nuestra configuración de despliegue. Si observamos estos archivos observaremos que contienen transformaciones XML que se aplican sobre el archivo web.config al desplegar la aplicación. De este modo cuando desplegamos la aplicación en modo &lt;em&gt;Debug&lt;/em&gt; se aplicarán las transformaciones XML definidas en &lt;em&gt;Web.Debug.config&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;El archivo de configuración aplica un mecanismo de jerarquía a nivel de los archivos de configuración, en la que un archivo de mayor profundidad dentro de la jerarquía sobrescribe al de menor, en el contexto del recurso solicitado.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_33.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_13.png" width="177" height="365"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Por ejemplo, si dentro de nuestra aplicación tenemos un archivo web.config sobre la raíz del sitio (en gris sobre la imagen), y otro sobre la carpeta Views (en rojo), el archivo de configuración de la carpeta Views prevalece y sobrescribe el valor del archivo de configuración raiz (siempre que el recurso solicitado sea se encuentre el directorio, en este ejemplo &lt;em&gt;Views&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;De esta forma podemos por ejemplo establecer en nuestro sitio web “areas” públicas y privadas de manera muy sencilla, tan fácil separar los archivo es directorios e como incluir un archivo de configuración con la seguridad activada sobre el directorio privado, y otro accesible a todo el mundo en el directorio privado. Veremos como hacer esto con Areas de ASP.NET un poquito mas adelante.&lt;/p&gt;
&lt;h3&gt;El archivo global.asax&lt;/h3&gt;
&lt;p&gt;Toda aplicación ASP.NET MVC es una instancia de una clase derivada de System.Web.HttpApplication. Esta clase es el punto de entrada de nuestra aplicación – el &lt;em&gt;Main&lt;/em&gt; de la aplicación web por decirlo de alguna manera. Como podemos observar, la clase base es la misma que para una aplicación ASP.NET clásica (WebForms) por lo que todos que podemos reutilizar todo lo que ya sabíamos de ASP.NET.&lt;/p&gt;
&lt;p&gt;Desde este archivo podemos manejar eventos a nivel de aplicación, sesión, cache, autenticacion,&amp;nbsp; etc ...&lt;/p&gt;
&lt;p&gt;Este archivo varia mucho desde la versión anterior de ASP.NET MVC, aunque el funcionamiento es el mismo. En ASP.NET MVC 4 se ha incluido el directorio App_Start que nos permite organizar como se inicializa la aplicación.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: green"&gt;// Por defecto, el namespace corresponde con el nombre del proyecto 
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1 
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;MvcApplication &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: System.Web.&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;HttpApplication
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;protected void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Application_Start()
        {
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;AreaRegistration&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RegisterAllAreas();
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WebApiConfig&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Register(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;GlobalConfiguration&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Configuration);
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;FilterConfig&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RegisterGlobalFilters(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;GlobalFilters&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Filters);
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;RouteConfig&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RegisterRoutes(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;RouteTable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Routes);
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;BundleConfig&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RegisterBundles(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;BundleTable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Bundles);
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;AuthConfig&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RegisterAuth();
        }
    }
}&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Como podemos ver, el código se encarga de registrar las áreas definidas en el proyecto, cargar la configuración, filtros, etc…, en definitiva, se encarga de configurar la aplicación para que esta pueda ejecutar de manera correcta. Las clases de configuración se encuentran en el directorio App_Start&lt;/p&gt;
&lt;p&gt;En el siguiente enlace podemos encontrar la documentación oficial sobre el archivo global.asax &lt;a href="http://msdn.microsoft.com/en-us/library/1xaas8a2(v=vs.71).aspx"&gt;&lt;font color="#0066cc"&gt;http://msdn.microsoft.com/en-us/library/1xaas8a2(v=vs.71).aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;La lista completa de eventos disponibles es la siguiente:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: green"&gt;// Summary:
//     Occurs when ASP.NET acquires the current state (for example, session state)
//     that is associated with the current request.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler AcquireRequestState;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when a security module has established the identity of the user.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler AuthenticateRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when a security module has verified user authorization.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler AuthorizeRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs as the first event in the HTTP pipeline chain of execution when ASP.NET
//     responds to a request.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler BeginRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when the application is disposed.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler Disposed;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs as the last event in the HTTP pipeline chain of execution when ASP.NET
//     responds to a request.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler EndRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when an unhandled exception is thrown.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler Error;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs just before ASP.NET performs any logging for the current request.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler LogRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when the handler is selected to respond to the request.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler MapRequestHandler;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when the request state (for example, session state) that is associated
//     with the current request has been obtained.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostAcquireRequestState;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when a security module has established the identity of the user.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostAuthenticateRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when the user for the current request has been authorized.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostAuthorizeRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET has completed processing all the event handlers for the
//     System.Web.HttpApplication.LogRequest event.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostLogRequest;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET has mapped the current request to the appropriate event
//     handler.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostMapRequestHandler;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET has completed executing all request event handlers and
//     the request state data has been stored.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostReleaseRequestState;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when the ASP.NET event handler (for example, a page or an XML Web
//     service) finishes execution.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostRequestHandlerExecute;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET bypasses execution of the current event handler and allows
//     a caching module to serve a request from the cache.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostResolveRequestCache;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET finishes updating caching modules and storing responses
//     that are used to serve subsequent requests from the cache.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PostUpdateRequestCache;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs just before ASP.NET starts executing an event handler (for example,
//     a page or an XML Web service).
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PreRequestHandlerExecute;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs just before ASP.NET sends content to the client.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PreSendRequestContent;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs just before ASP.NET sends HTTP headers to the client.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler PreSendRequestHeaders;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs after ASP.NET finishes executing all request event handlers. This
//     event causes state modules to save the current state data.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler ReleaseRequestState;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when the managed objects that are associated with the request have
//     been released.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler RequestCompleted;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET finishes an authorization event to let the caching modules
//     serve requests from the cache, bypassing execution of the event handler (for
//     example, a page or an XML Web service).
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler ResolveRequestCache;
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;//
// Summary:
//     Occurs when ASP.NET finishes executing an event handler in order to let caching
//     modules store responses that will be used to serve subsequent requests from
//     the cache.
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: black"&gt;EventHandler UpdateRequestCache;&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;h3&gt;Home Controller&lt;/h3&gt;
&lt;p&gt;La clase HomeController es el punto de entrada de la aplicación, la página por defecto.&lt;/p&gt;
&lt;p&gt;Cuando creamos un nuevo proyecto ASP.NET MVC se crea también un controlador HomeController situado directamente el folder &lt;em&gt;Controllers&lt;/em&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_37.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_15.png" width="144" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;El controlador de ejemplo que se incluye en el proyecto por defecto, incluye tres métodos: &lt;em&gt;Index&lt;/em&gt;, &lt;em&gt;About &lt;/em&gt;y &lt;em&gt;Contact&lt;/em&gt;, que disponen de sus correspondiente vistas en el folder &lt;em&gt;Home&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_43.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_18.png" width="119" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;El código del HomeController es el siguiente:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1.Controllers
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;HomeController &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Controller
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ActionResult &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Index()
        {
            ViewBag.Message = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Modify this template to jump-start your ASP.NET MVC application."&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;

            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;View();
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ActionResult &lt;/span&gt;&lt;span style="background: white; color: black"&gt;About()
        {
            ViewBag.Message = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Your app description page."&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;

            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;View();
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ActionResult &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Contact()
        {
            ViewBag.Message = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Your contact page."&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;

            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;View();
        }
    }
}
&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Como podemos ver cada uno de los métodos del controlador devuelve la vista asociada por defecto:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Index() devuelve la vista index.cshtml 
&lt;li&gt;About() devuelve la vista about.cshtml 
&lt;li&gt;Contact() devuelve la vista contact.cshtml&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Veremos los controladores en el siguiente capitulo.&lt;/p&gt;
&lt;h3&gt;Creación de Áreas.&lt;/h3&gt;
&lt;p&gt;Como hemos visto, ASP.NET MVC divide los elementos que componen su arquitectura en carpetas con el mismo nombre (&lt;em&gt;Models&lt;/em&gt;, &lt;em&gt;Views&lt;/em&gt;, &lt;em&gt;Controllers&lt;/em&gt;). Esta división es fácil e intuitiva pero puede ser limitada en aplicaciones grandes, donde el número de entidades a manejar sea grande. Para estos casos ASP.NET MVC proporciona un mecanismo muy sencillo que nos permite agrupar contenidos (y sus configuraciones) denominadas &lt;strong&gt;Areas&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Un &lt;strong&gt;Area&lt;/strong&gt; no es mas que una carpeta que replica en su interior la estructura anterior de MVC - &lt;em&gt;Model, Views, Controllers &lt;/em&gt;y define sus propias rutas de acceso a través de la clase &lt;em&gt;PublicContentAreaRegistration &lt;/em&gt;que se crea automáticamente al añadir una nueva área. Tiene la ventaja adicional de tener su propio archivo de configuración de modo que es ideal para diferenciar zonas públicas y privadas por ejemplo.&lt;/p&gt;
&lt;p&gt;Podemos crear &lt;strong&gt;Areas&lt;/strong&gt; del siguiente modo:&lt;/p&gt;
&lt;p&gt;Sobre el explorador de soluciones de Visual Studio, &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_35.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_14.png" width="536" height="439"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Visual Studio nos preguntara el nombre del área que queremos crear, en nuestro caso le damos el nombre &lt;em&gt;PublicContent&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_39.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_16.png" width="244" height="90"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Podemos ver que se ha creado en Visual Studio un directorio &lt;em&gt;Areas&lt;/em&gt;, con un subdirectorio &lt;em&gt;PublicContent &lt;/em&gt;en el que podemos encontrar la estructura de carpetas de &lt;em&gt;Controllers&lt;/em&gt;, &lt;em&gt;Models &lt;/em&gt;y &lt;em&gt;Views &lt;/em&gt;que ya hemos visto anteriormente.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_41.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/CrearunaaplicacinASP.NETMVC_11A01/image_thumb_17.png" width="244" height="239"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;También tenemos un archivo de configuración (que nos permite sobrescribir la configuración raiz a través del mecanismo de jerarquia explicado anteriormente) y un archivo PublicContentAreaRegistration.cs en el que se registra la ruta del área sobre la tabla de rutas de ASP.NET MVC (veremos como funciona este mecanismo mas adelante), de momento diremos que la tabla de ruta establece un mapeo entre las URLs que envía el navegador y el controlador que debe gestionar estas peticiones.&lt;/p&gt;</description>
    </item>
    <item>
      <title>El valor de this en Javascript: cómo manejarlo correctamente</title>
      <link>http://www.devjoker.com/contenidos/articulos/532/El-valor-de-this-en-Javascript-como-manejarlo-correctamente.aspx</link>
      <description>&lt;p&gt;Articulo reproducido de &lt;a href="http://www.etnassoft.com"&gt;http://www.etnassoft.com&lt;/a&gt;, con el consentimiento de &lt;a href="http://www.etnassoft.com/quienes-somos/"&gt;Carlos Benítez&lt;/a&gt; autor del post original.&lt;/p&gt; &lt;p&gt;Enlace al post original: &lt;a href="http://www.etnassoft.com/2012/01/12/el-valor-de-this-en-javascript-como-manejarlo-correctamente/"&gt;http://www.etnassoft.com/2012/01/12/el-valor-de-this-en-javascript-como-manejarlo-correctamente/&lt;/a&gt;&lt;/p&gt; &lt;h2&gt;Introducción&lt;/h2&gt; &lt;p&gt;this es un valor complejo en Javascript; un error en el diseño del lenguaje susceptible de causar tanto comportamientos inesperados como potentes estructuras de código reutilizable. Su valor, lejos de ser intuitivo, se determina según la forma en que se invoque a la función que lo encierra, algo que no siempre es correctamente entendido o aprovechado.  &lt;p&gt;Dado que el correcto manejo de this resulta esencial en la programación orientada a objetos, y en definitiva en el desarrollo moderno de aplicaciones, es interesante dedicar unos minutos a revisarlo.  &lt;h2&gt;Qué es exactamente this &lt;/h2&gt; &lt;p&gt;La palabra clave this tiene en Javascript un comportamiento diferente al de otros lenguajes pero por lo general, su valor hace referencia al propietario de la función que la está invocando o en su defecto, al objeto donde dicha función es un método.  &lt;p&gt;La palabra clave del párrafo anterior es “propietario“.  &lt;p&gt;Cuando no estamos dentro de una estructura definida, esto es un objeto con métodos, el propietario de una función es siempre el contexto global. En el caso de los navegadores web, tenemos que recordar que dicho objeto es window: &lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;console.log(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this &lt;/span&gt;&lt;span style="background: white; color: black"&gt;=== window);  &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// true
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;test() {
    console.log(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this &lt;/span&gt;&lt;span style="background: white; color: black"&gt;=== window);
}
test(); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// true&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;
&lt;h2&gt;Accediendo a los valores de un objeto desde el propio objeto &lt;/h2&gt;
&lt;p&gt;Este concepto de propietario puede inducir a errores. Pensemos en un objeto con una serie de propiedades: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;myApp = {
    name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Megan'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastName: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Fox'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    birthDate: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'16/05/1986'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    isPretty: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;true
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;};
console.log(myApp.name); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Megan
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;console.log(myApp.isPretty); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// true&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;Supongamos ahora que necesitamos otra propiedad más ‘dinámica’ que participe de los valores asignados a cualquier otra. Por ejemplo, queremos un ‘completeName‘ que concatene ‘name‘ y ‘lastName‘. Parece que este un claro ejemplo de uso para this: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;myApp = {
    name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Megan'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastName: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Fox'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    completeName: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.name + &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.lastName
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Aunque parece coherente, cuando pasamos a comprobarlo vemos que el resultado no es el esperado: &lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;console.log(myApp.completeName); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// undefined&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;El problema aquí es que this no está apuntando al objeto como cabría esperar, sino que está buscando la referencia fuera, en el contexto global (window). 
&lt;p&gt;Para obtener el resultado esperado tenemos que aplicar un patrón de invocación que modifique al propietario desde el que se invoca el this… 
&lt;h2&gt;Patrón de invocación por método &lt;/h2&gt;
&lt;p&gt;En Javascript, existen varias formas de llamar a las funciones desde nuestro código; concretamente, podemos enumerar hasta cinco diferentes. La elección de una u otra responde al flujo de nuestro programa pero básicamente, difieren en el contexto que queramos aplicar a cada una. O lo que es lo mismo, al valor que queramos que la función asigne a la referencia this. 
&lt;p&gt;En el desarrollo de aplicaciones modernas, el patrón más recurrente es el de invocación por método: una función es almacenada como propiedad de un objeto convirtiéndose así en lo que denominamos un método. 
&lt;p&gt;Cuando llamamos (invocamos) a un método, this hace refencia al propio objeto: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;myApp = {
    name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Megan'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastName: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Fox'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    completeName: &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.name + &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;' ' &lt;/span&gt;&lt;span style="background: white; color: black"&gt;+ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.lastName;
    }
}
console.log(myApp.completeName()); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Megan Fox&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;En esta ocasión, si podemos comprobar como this apunta al propio objeto y busca la propiedades ‘name‘ y ‘lastName‘ dentro en lugar de remontarse hasta el contexto global. 
&lt;p&gt;Pero como vimos en el caso anterior, no siempre el uso de this es intuitivo. Consideremos la siguiente estructura: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;myApp = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"World"
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sayHello = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
        console.log(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Hello, ' &lt;/span&gt;&lt;span style="background: white; color: black"&gt;+ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.name);
    };
    sayHello(); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Invoke the function
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;};
myApp(); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Hello,&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;¿A dónde está apuntando this en este caso? Como la función no es ahora la propiedad de un objeto, this apunta de nuevo al global (window). Esto es un error en el diseño del lenguaje ya que, de comportarse como se espera, this debería apuntar a la función contenedora (que no deja de ser su propietaria). 
&lt;p&gt;Este comportamiento lo podemos comprobar si creamos una variable global con aquel nombre por el que estamos preguntando: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Strange World"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;myApp = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"World"
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sayHello = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
        console.log(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Hello, ' &lt;/span&gt;&lt;span style="background: white; color: black"&gt;+ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.name);
    };
    sayHello();
};
myApp(); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Hello, Strange World&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;La consecuencia de este error es que un método no puede utilizar funciones internas que la ayuden a hacer su trabajo porque éstas, no tiene acceso a sus propiedades. 
&lt;p&gt;Para resolver este problema, podemos recurrir a una solución muy simple: definir dentro de nuestra función contenedora una nueva variable que cachee el valor de this para que así esté disponible desde cualquier otra función anidada que lo precise. Por convención, el nombre de esta variable es that: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;myApp = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;that = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Work around!
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"World"
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sayHello = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
        console.log(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Hello, ' &lt;/span&gt;&lt;span style="background: white; color: black"&gt;+ that.name);
    };
    sayHello();
};
myApp(); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Hello, World&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;NOTA: Últimamente, la convención que propuso Douglas Crockford está siendo revisada y son muchos los desarrolladores que prefieren el término self para referirse al objeto cacheado. 
&lt;h2&gt;Sobreescribiendo el valor de this en tiempo de ejecución &lt;/h2&gt;
&lt;p&gt;Una de las características consideradas avanzadas dentro del lenguaje Javascript es la posibilidad de reescribir el valor de this en tiempo de ejecución consiguiendo así una modularidad y reusabilidad extrema. 
&lt;p&gt;Más arriba comentamos que existen varias formas de invocar funciones en Javascript donde la elección entre una u otra depende del valor que queramos asignar a this. 
&lt;p&gt;Consideremos el siguiente codigo: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;person1 = {
    name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Angelina'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastName: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Jolie'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    birthDay: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'04/06/1975'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastMovie: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'The Tourist'
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;};
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;person2 = {
    name: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Scarlett'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastName: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Johansson'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    birthDay: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'22/11/1984'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
    lastMovie: &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'We bought a Zoo'
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;}
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;printName = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;() {
    console.log(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.name + &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;' ' &lt;/span&gt;&lt;span style="background: white; color: black"&gt;+ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.lastName);
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;Si tratamos de ejecutar sin más la función printName, ya sabemos que el this apunta al objeto global window e irá ahí a buscar las propiedas name y lastName. 
&lt;p&gt;En una arquitectura modular, lo ideal es que esa función pueda ser reaprovechada y que nos permita imprimir los datos de cualquier objeto que cumpla con los requisitos. Para ello, podemos cambiar el valor de this en tiempo de ejecución con el fin de que apunte a ese objeto en cuestión. Para ello, contamos con las funciones nativas apply y call: &lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;printName.call(person1); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Angelina Jolie
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;printName.call(person2); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Scarlett Johansson
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;printName.apply(person1); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Angelina Jolie
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;printName.apply(person2); &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Scarlett Johansson&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;El resultado es el mismo: hemos ejecutado la función printName dentro del contexto de cada uno de los objetos que hemos pasado como argumento. 
&lt;p&gt;La diferencia entre cada uno de estas funciones es que la segunda de ellas, apply, acepta un array como argumento, lo que permite una flexibilidad aún mayor a la hora de plantear código reusable. 
&lt;p&gt;Pensemos en una función que nos permita actualizar datos dentro de nuestros objetos: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;updatePerson = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(name, lastName, birthDay, lastMovie) {
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.name = name;
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.lastName = lastName;
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.birthDay = birthDay;
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.lastMovie = lastMovie;
}
updatePerson(person1, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Angelina'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Jolie'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'04/06/1975'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Kung Fu Panda 2'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;Las limitaciones de call se hacen rápidamente evidentes cuando queremos escribir código que no conoce (o no debe conocer) el número de argumentos que la función necesita. 
&lt;p&gt;Tomemos por ejemplo una función que siga el conocido paradigma del ‘dispatcher‘: &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;dispatch = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;function &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(person, method, args) {
    method.apply(person, args);
}
dispatch(person1, printName);
dispatch(person2, update, [&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Scarlett'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'Johansson'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'22/11/1982'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;'The Avengers'&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;En este caso, el poder jugar con el valor de this y además asociar una serie de datos a través de un array, permite una poderosa flexibilidad a la hora de escribir código reutilizable. 
&lt;h2&gt;Conclusión &lt;/h2&gt;
&lt;p&gt;El valor de this ha sido siempre difícil de manejar en Javascript. Las pequeñas diferencias que presenta frente a otros lenguajes así como un error en su diseño, lo hacen francamente especial. Sin embargo, esa peculiaridad, es precisamente la que permite crear un tipo de código muy versátil una vez que conocemos sus secretos. 
&lt;p&gt;Manejarlo correctamente es una parte esencial dentro del desarrollo de aplicaciones complejas en Javascript.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Visual Studio modifica la configuración de Proxy al ejecutar los test unitarios.</title>
      <link>http://www.devjoker.com/contenidos/articulos/531/Visual-Studio-modifica-la-configuracion-de-Proxy-al-ejecutar-los-test-unitarios.aspx</link>
      <description>&lt;p&gt;Ayer migré la solución de devjoker.com desde Visual Studio 2010 a Visual Studio 2012. Todo parecía funcionar sin problemas. pero hoy me he encontrado con que al ejecutar los test unitarios en Visual Studio 2012, se modifican las “Opciones de Internet”, activando al casilla “usar servidor proxy”. Todo parece funcionar correctamente cuando Visual Studio está activo, pero cuando lo cerramos nos encontramos con que la conexión a internet ha dejado de funcionar.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/VisualStudiomodificalaconfiguracindePro_11D62/image_2.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/VisualStudiomodificalaconfiguracindePro_11D62/image_thumb.png" width="244" height="189"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Por supuesto, he llegado a esta conclusión tras volverme loco un buen rato y maldecir un par de veces a «ya sabéis quien». Tras un rato de «ver que pasa», he descubierto de que el problema viene de la configuración de test que tenia en la maquina.&lt;/p&gt; &lt;p&gt;Para solucionar este problema, debemos modificar la configuración de test de nuestro archivo .testsettings, y desactivar la opción «ASP.NET Client Proxy for intellitrace and TestInpact»&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/VisualStudiomodificalaconfiguracindePro_11D62/image_4.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/VisualStudiomodificalaconfiguracindePro_11D62/image_thumb_1.png" width="244" height="120"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Bueno, espero que este post un ahorre el tiempo que yo he perdido buscando la solución.&lt;/p&gt; &lt;p&gt;Saludos, &lt;/p&gt; &lt;p&gt;DJK.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test de métodos privados. PrivateObject</title>
      <link>http://www.devjoker.com/contenidos/articulos/530/Test-de-metodos-privados-PrivateObject.aspx</link>
      <description>&lt;p&gt;Cuando realizamos test unitarios, en principio solo podemos realizar test de los métodos públicos. Pero es habitual querer realizar test de métodos privados, Visual Studio permite crear clases de acceso, denominadas “accesors”, estas clases se generar automáticamente cuando seleccionamos la opción de “generar test” desde el menú contextual del editor de código, pero es un sistema poco intuitivo que personalmente no me gusta nada. Además en VisualStudio 2012 la opción de generar los test automáticamente esta bastante escondida …&lt;a href="http://dl.my/2013/enable-create-unit-tests-on-visual-studio-2012/"&gt;&lt;font color="#0066cc"&gt;http://dl.my/2013/enable-create-unit-tests-on-visual-studio-2012/&lt;/font&gt;&lt;/a&gt; .&lt;/p&gt; &lt;p&gt;Otra forma mas elegante e intuitiva (a mi juicio) es utilizar la clase &lt;em&gt;PrivateObject&lt;/em&gt; que nos permite ejecutar métodos privados y poder testearlos. &lt;/p&gt; &lt;p&gt;Veamos un ejemplo. Supongamos la siguiente clase, &lt;em&gt;Foo&lt;/em&gt;. La clase tiene un única método público, que a partir de un array de cadenas de texto, devuelve un nuevo array con los tres primeros caracteres del texto de entrada. No es nada complejo, pero así salimos un poco del clásico ejemplo de la calculadora que utiliza todo el mundo cuando habla de testing…&amp;nbsp; &lt;/p&gt; &lt;p&gt;La clase es la siguiente:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;[] names;
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Foo(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;[] names)
    {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.names = names;
    }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;[] GetShortNames()
    {
        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;String&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; returnValue = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;(names.Length);

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;foreach &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;names)
        {
            returnValue.Add(GetShortName(name));
        }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;returnValue.ToArray();
    }

    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;GetShortName(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name)
    {
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name.Length &amp;gt; 3 ? name.Substring(0, 3) : name;
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Como podemos ver, el método público &lt;em&gt;GetShortNames&lt;/em&gt; utiliza un método privado &lt;em&gt;GetShortName&lt;/em&gt;. Por supuesto que testeando el método público estamos testeando también el privado, pero es mejor testear ambos, entre otras ventajas, si algo falla nos permitirá determinar más fácilmente donde esta el error. Además si aplicamos &lt;a href="http://es.wikipedia.org/wiki/Desarrollo_guiado_por_pruebas"&gt;TDD&lt;/a&gt; es imprescindible.&lt;/p&gt;
&lt;p&gt;Ahora vamos a ver el ejemplo del test del método privado. Por supuesto necesitamos agregar un nuevo proyecto de test a nuestra solucion, y agragar una clase FooTest como la siguiente:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Microsoft.VisualStudio.TestTools.UnitTesting;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;ConsoleApplication1.UnitTest
{
    [&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;TestClass&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;FooTest
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// SUT: Foo

        &lt;/span&gt;&lt;span style="background: white; color: black"&gt;[&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;TestMethod&lt;/span&gt;&lt;span style="background: white; color: black"&gt;]
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;GetShortNameTest()
        {
            &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// arrange
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;foo = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;[0]);
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;privateObject = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PrivateObject&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(foo, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PrivateType&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;typeof &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Foo&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)));
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;name = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"www.devjoker.com"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
            
            &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// act
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;actual = privateObject.Invoke(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"GetShortName"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, name);

            &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// assert
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Assert&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.AreEqual(actual, &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"www"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
        }
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Como podemos ver, creamos una instancia de la clase &lt;em&gt;Foo&lt;/em&gt;, y la utilizamos para crear un objeto &lt;em&gt;PrivateObject&lt;/em&gt; con el que invocamos al método privado. Al ejecutar el test podemos ver que se ejecuta el método privado, que es lo que pretendíamos.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testdemtodosprivados.PrivateObject_14EB6/image_2.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/WindowsLiveWriter/Testdemtodosprivados.PrivateObject_14EB6/image_thumb.png" width="718" height="346"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Saludos, &lt;/p&gt;
&lt;p&gt;DJK&lt;/p&gt;</description>
    </item>
    <item>
      <title>Introducción a KendoUI</title>
      <link>http://www.devjoker.com/contenidos/articulos/529/Introduccion-a-KendoUI.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://www.kendoui.com" target="_blank"&gt;KendoUI&lt;/a&gt; es un framework de componentes basado en &lt;a href="http://www.jquery.com" target="_blank"&gt;jQUERY&lt;/a&gt; para agilizar el desarrollo web que está siendo desarrollado por la empresa Telerik; inicialmente nació con el objetivo de ofrecer componentes HTML5 y CSS 3, actualmente y gracias a las frecuentes actualizaciones soporta además del desarrollo vía JavaScript el desarrollo desde el lado servidor con versiones para &lt;a href="http://asp.net/MVC" target="_blank"&gt;ASP.NET MVC&lt;/a&gt;, JSP y PHP, así como componentes para desarrollar web móviles adaptadas al estilo de los sistemas móviles más importantes, y componentes para realizar gráficos.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Lo primero que vamos a hacer es descargar alguna de las versiones de &lt;a href="http://www.kendoui.com" target="_blank"&gt;KendoUI&lt;/a&gt;, para ello vamos a su web (&lt;a href="http://www.kendoui.com"&gt;http://www.kendoui.com&lt;/a&gt;) y en la sección downloads vemos las versiones disponibles, si vamos a desarrollar un proyecto open source tenemos la posibilidad de descargar la versión GPL 3 que aunque sólo ofrece los componentes web y acceso a las versiones mayores para probar y conocer el framework es más que suficiente. En este caso voy a descargar la versión Complete en versión trial, para poder realizar la descarga tenemos que crearnos una cuenta en la web de &lt;a href="http://www.kendoui.com" target="_blank"&gt;KendoUI&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/kendoUIDownload_2.png"&gt;&lt;img title="kendoUIDownload" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="KendoUI Dowload" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/kendoUIDownload_thumb.png" width="569" height="484"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Un vez descargado, descomprimimos el fichero y tenemos un conjunto de carpetas, nosotros vamos a necesitar las carpetas js, styles que contienen los ficheros JavaScript y los estilos CSS junto con las imágenes que vamos a necesitar. Si hubiéramos descargado la versión comercial además de estas carpetas tendríamos una más llamada src que contiene los ficheros JavaScript y estilos CSS sin “minificar” con lo que podemos leerlos bien formateados o incluso editarlos si es que nos atrevemos.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/KendoUIDescomprimido_2.png"&gt;&lt;img title="KendoUIDescomprimido" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="KendoUIDescomprimido" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/KendoUIDescomprimido_thumb.png" width="644" height="234"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Ahora que tenemos ya todos los ficheros necesarios, abrimos Visual Studio (en mi caso 2012) y creamos una nueva aplicación web MVC 4 de tipo Internet, yo la he llamado KendoUISample.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/VisualStudioNuevoProyecto_4.png"&gt;&lt;img title="VisualStudioNuevoProyecto" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="VisualStudioNuevoProyecto" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/VisualStudioNuevoProyecto_thumb_1.png" width="644" height="392"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Una vez creado el proyecto añadimos los ficheros JavaScript y los CSS a la solución.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.kendoui.com" target="_blank"&gt;KendoUI&lt;/a&gt; nos proporciona diferentes ficheros JavaScript para cada uno de los componentes por si solo queremos usar alguno en concreto, además nos proporciona también un fichero con todo (kendo.all.min.js)&amp;nbsp; que es el que voy a añadir yo, también proporciona los ficheros para tener documentación en JavaScript (kendo.all.min.intellisense.js para Visual Studio 2012 y kendo.all-vsdoc.js para las versiones anteriores de Visual Studio).&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/KendoUIFicherosIncluidos_2.png"&gt;&lt;img title="KendoUIFicherosIncluidos" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="KendoUIFicherosIncluidos" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/KendoUIFicherosIncluidos_thumb.png" width="262" height="521"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Ahora en la vista _Layout.cshtml que se encuentra dentro de la carpeta Views\Shared añadimos las referencias a los ficheros de estilos y de JavaScript.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/CambiosLayout_2.png"&gt;&lt;img title="CambiosLayout" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="CambiosLayout" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/CambiosLayout_thumb.png" width="644" height="393"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Por último vamos a crear un control calendario en la vista Index.cshtml de la carpeta Views\Home, para ellos añadimos un nuevo input con id datepicker y en una sección añadimos el código JavaScript que convertirá el input en un control de calendario de &lt;a href="http://www.kendoui.com" target="_blank"&gt;KendoUI&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/CambiosIndex_2.png"&gt;&lt;img title="CambiosIndex" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="CambiosIndex" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/CambiosIndex_thumb.png" width="644" height="393"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Ejecutamos la aplicación y podemos ver el calendario funcionando. En la primera captura podemos ver el aspecto cerrado y en la segunda abierto.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/DatepickerCerrado_4.png"&gt;&lt;img title="DatepickerCerrado" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="DatepickerCerrado" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/DatepickerCerrado_thumb_1.png" width="644" height="347"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/DatepickerAbierto_4.png"&gt;&lt;img title="DatepickerAbierto" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 100px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="DatepickerAbierto" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/Introduccin-a-KendoUI_9716/DatepickerAbierto_thumb_1.png" width="644" height="346"&gt;&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Patrón MVC. Modelo Vista Controlador</title>
      <link>http://www.devjoker.com/contenidos/articulos/525/Patron-MVC-Modelo-Vista-Controlador.aspx</link>
      <description>&lt;p&gt;MVC es un patrón arquitectónico cuyo principal propósito es establecer una separación clara entre la interfaz de usuario que presenta la aplicación y la lógica de negocio que maneja&amp;nbsp; la aplicación. Se trata de un patrón antiguo, se remonta a los años a finales de los años 70, pero que ahora vive una nueva época de esplendor gracias a su intensa utilización en los entornos de desarrollo web.&lt;/p&gt; &lt;p&gt;ASP.NET MVC es el framework que propone Microsoft para el desarrollo web utilizando el patrón MVC sobre la tecnología ASP.NET. Esto, que a priori puede parecer evidente tiene una consecuencia inmediata: gran parte de los que podamos saber de ASP.NET WebForms es aplicable en ASP.NET MVC: Modelo de objetos integrado (Server, Response, Request …),Seguridad (API Membership),Modulos HTTP,Handlers …&lt;/p&gt; &lt;p&gt;Actualmente (abril 2013), ASP.NET se encuentra en su cuarta versión, y se ha convertido en un proyecto de código abierto: &lt;a href="http://www.asp.net/mvc/open-source"&gt;http://www.asp.net/mvc/open-source&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Los elementos que componen el patrón son los siguientes:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;El controlador. Es el elemento encargo de recibir y procesar la peticiones HTTP. Su responsabilidad es retornar una vista concreta con el modelo correcto.  &lt;li&gt;El modelo. Corresponde con la representación de los datos/entidades de negocio que modelan la aplicación.  &lt;li&gt;La vista. El contenido que va a ser devuelto como consecuencia de la petición HTTP. La vista recibe el modelo para poder realizar la presentación de los datos.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;El siguiente diagrama ilustra el proceso.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Order15PatrnMVC.ModeloVistaControlador_1CE9/image_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Order15PatrnMVC.ModeloVistaControlador_1CE9/image_thumb_1.png" width="473" height="248"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Aplicado a la ASP.NET MVC, el diagrama funciona de la siguiente manera:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;El navegador realiza un petición a una determinada URL.  &lt;li&gt;ASP.NET MVC recibe la petición y determinar el controlador que debe ejecutarse (veremos más adelante como se realiza este proceso).  &lt;li&gt;El controlador:  &lt;ul&gt; &lt;li&gt;Recibe la petición HTTP.  &lt;li&gt;Procesa los datos, y crea u obtiene el modelo.  &lt;li&gt;Retorna una vista, a la que normalmente le asigna el modelo (aunque no es necesario establecer un modelo). &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;La vista que ha retornado el controlador, es interpretada por el motor de renderización de ASP.NET MVC «&lt;strong&gt;Razor&lt;/strong&gt;», que procesa la vista para generar el documento HTML que será devuelto finalmente al navegador  &lt;li&gt;El navegador muestra la página.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Nota: ASP.NET MVC dispone de varios motores de renderización – Razor, aspx, -&amp;nbsp; , en este tutorial utilizaremos Razor.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Order15PatrnMVC.ModeloVistaControlador_1CE9/image_10.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Order15PatrnMVC.ModeloVistaControlador_1CE9/image_thumb_4.png" width="477" height="197"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Nota: Los controladores pueden devolver diferentes tipos de contenido no solo documentos HTML, aunque en el dibujo se especifica únicamente HTML para simplificar el concepto.&lt;/p&gt; &lt;p&gt;Es por tanto, el controlador el encargado de coordinar la ejecución, generar el modelo y devolver la vista.&lt;/p&gt; &lt;p&gt;Veamos un ejemplo muy básico :&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.Mvc;
&lt;span style="color: blue"&gt;using &lt;/span&gt;DevjokerMvcTutorial.Models;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DevjokerMvcTutorial.Controllers
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;BasicController &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;Controller
    &lt;/span&gt;{               
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ActionResult &lt;/span&gt;Index()
        {
            &lt;span style="color: green"&gt;// Este método devuelve la vista index.cshtml, del directorio Views
            // Equivalente a return View("Index")
            &lt;/span&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;View(); 
        }
    }
}&lt;/pre&gt;
&lt;p&gt;Como podemos ver un controlador es una clase derivada de &lt;em&gt;Controller&lt;/em&gt;, esta clase está definida en el framework de ASP.NET MVC y nos proporciona gran parte de la funcionalidad que vamos a necesitar. Entre esta funcionalidad se encuentra el método &lt;em&gt;View()&lt;/em&gt; que nos permite devolver una vista (archivo con extensión &lt;em&gt;.cshtml&lt;/em&gt; que será procesada por Razor)&lt;/p&gt;
&lt;p&gt;El archivo de vista, &lt;em&gt;index.cshtml&lt;/em&gt; tiene el siguiente aspecto (la vista puede ser un archivo &lt;em&gt;html &lt;/em&gt;sin código &lt;em&gt;Razor&lt;/em&gt;):&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@{
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;    ViewBag.Title = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Index"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;}
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h2&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Index View&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h2&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;p&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Pagina index.cshtml - www.devjoker.com&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;p&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;ASP.NET MVC hace uso intensivo de las convenciones, una de las mas importantes es la forma en la que se determina la ubicación física de las vistas. Cuando especificamos en un controlador &lt;em&gt;BasicController&lt;/em&gt; un llamada al método &lt;em&gt;View()&lt;/em&gt; el motor buscara una vista con el mismo nombre que el método invocado en la ruta «Views/Basic/» . De forma que si un controlador &lt;em&gt;BasicController&lt;/em&gt; dispone de un método &lt;em&gt;ProductList &lt;/em&gt;el método &lt;em&gt;View()&lt;/em&gt; buscara la vista &lt;em&gt;Views/Basic/ProductList.cshtml.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Pongamos algunos ejemplos con colorines para que quede claro:&lt;/p&gt;
&lt;p&gt;Una petición con la siguiente URL:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;http://localhost:5421/&lt;font color="#ff8040"&gt;Basic&lt;/font&gt;/&lt;font color="#0000ff"&gt;ProductList&lt;/font&gt; ejecutara el controller &lt;em&gt;BasicController&lt;/em&gt;, método &lt;em&gt;ProductList &lt;/em&gt;…&lt;em&gt;&lt;font color="#ff8000"&gt;&amp;nbsp;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font color="#ff8000"&gt;Basic&lt;/font&gt;Controller-&amp;gt;&lt;font color="#0000ff"&gt;ProductList&lt;/font&gt;-&amp;gt;View() que devolverá la vista …&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Views/&lt;font color="#ff8000"&gt;Basic&lt;/font&gt;/&lt;font color="#0000ff"&gt;ProductList&lt;/font&gt;.cshtml&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Del mismo modo:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p align="left"&gt;http://localhost:5421/&lt;font color="#ff8040"&gt;Product&lt;/font&gt;/&lt;font color="#0000ff"&gt;NewProduct&amp;nbsp; &lt;/font&gt;==&amp;gt; &lt;em&gt;&lt;font color="#ff8000"&gt;Product&lt;/font&gt;Controller-&amp;gt;&lt;font color="#0000ff"&gt;NewProduct&lt;/font&gt;-&amp;gt;View() ==&amp;gt;Views/&lt;font color="#ff8000"&gt;Product&lt;/font&gt;/&lt;font color="#0000ff"&gt;NewProduct&lt;/font&gt;.cshtml&lt;/em&gt;&lt;/p&gt;
&lt;p align="left"&gt;http://localhost:5421/&lt;font color="#ff8040"&gt;Client&lt;/font&gt;/&lt;font color="#0000ff"&gt;New &lt;/font&gt;==&amp;gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&lt;/font&gt;&lt;em&gt;&lt;font color="#ff8000"&gt;Client&lt;/font&gt;Controller-&amp;gt;&lt;font color="#0000ff"&gt;New&lt;/font&gt;-&amp;gt;View() ==&amp;gt;Views/&lt;font color="#ff8000"&gt;Client&lt;/font&gt;/&lt;font color="#0000ff"&gt;New&lt;/font&gt;.cshtml&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Nota: &lt;/em&gt;En realidad la búsqueda de la vista comienza en el directorio &lt;em&gt;Views, &lt;/em&gt;en el caso de no encontrarse este fichero se buscará en el directorio &lt;em&gt;Shared&lt;/em&gt;, otra de las convecciones de ASP.NET MVC. Estudiaremos mas en detalle este comportamiento cuando veamos &lt;em&gt;Razor&lt;/em&gt; y las vistas.&lt;/p&gt;
&lt;p&gt;Por supuesto, podemos modificar este comportamiento – podemos ver como en este artículo &lt;a href="http://www.variablenotfound.com/2009/06/cambiar-la-ubicacion-de-las-vistas-en.html"&gt;http://www.variablenotfound.com/2009/06/cambiar-la-ubicacion-de-las-vistas-en.html&lt;/a&gt; –, aunque de momento no haremos uso de esta característica.&lt;/p&gt;
&lt;p&gt;En el ejemplo anterior – dada su extrema simplicidad – no hemos utilizado un modelo de datos. Veamos ahora un ejemplo, también muy sencillo, en el que utilizamos un modelo. Supongamos que queremos mostrar en una página los datos de un cliente &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1.Models
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Client
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Guid Id { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;FirstName { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;SurName { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }

    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Y en el controlador añadiremos el método correspondiente para devolver el cliente:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Web.Mvc;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1.Models;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1.Controllers
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;BasicController&lt;/span&gt;&lt;span style="background: white; color: black"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Controller
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ActionResult &lt;/span&gt;&lt;span style="background: white; color: black"&gt;ClientDetail()
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;clientModel = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Client&lt;/span&gt;&lt;span style="background: white; color: black"&gt;()
                             {
                                 Id = Guid.NewGuid(),
                                 FirstName = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Pedro"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,
                                 SurName = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"Herrarte"
                             &lt;/span&gt;&lt;span style="background: white; color: black"&gt;};
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;View(clientModel);
        }
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Y por último la vista, &lt;em&gt;ClientDetail.cshtml&lt;/em&gt; , en la que incluimos el código necesario para mostrar los datos del cliente que inyectamos como modelo en el controlador:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: yellow; color: black"&gt;@model &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MvcApplication1.Models.&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Client

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;DOCTYPE &lt;/span&gt;&lt;span style="background: white; color: red"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;head&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;head&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;body&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h1&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Datos de cliente&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;h1&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@*&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;Código Razor, muestra la propiedad id del módelo&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;*@
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.LabelFor(m=&amp;gt;m.Id)
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.TextBoxFor(m=&amp;gt; m.Id)  
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@*&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;Código Razor, muestra la propiedad FirstName del módelo&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;*@
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.LabelFor(m=&amp;gt;m.FirstName)
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.TextBoxFor(m=&amp;gt; m.FirstName)
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@*&lt;/span&gt;&lt;span style="background: white; color: #006400"&gt;Código Razor, muestra la propiedad SurName del módelo&lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;*@
&lt;/span&gt;&lt;span style="background: white; color: black"&gt;                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.LabelFor(m=&amp;gt;m.SurName)
                &lt;/span&gt;&lt;span style="background: yellow; color: black"&gt;@&lt;/span&gt;&lt;span style="background: white; color: black"&gt;Html.TextBoxFor(m=&amp;gt; m.SurName)
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;div&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;body&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;html&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Ejecutamos la aplicación y&amp;nbsp; en nuestro navegador introducimos la URL siguiente: &lt;a href="http://localhost:3072/Basic/ClientDetail"&gt;&lt;em&gt;http://localhost:3072/Basic/ClientDetail&lt;/em&gt;&lt;/a&gt;&lt;em&gt; (&lt;/em&gt;la raiz de la url depende de la configuración del proyecto&lt;em&gt;) &lt;/em&gt;y&lt;em&gt; &lt;/em&gt;el resultado de la ejecución seria esta:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Order15PatrnMVC.ModeloVistaControlador_1CE9/image_5.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Order15PatrnMVC.ModeloVistaControlador_1CE9/image_thumb.png" width="244" height="158"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;En los siguientes capítulos del tutorial ampliando nuestros conocimientos de cada uno de los elementos de ASP.NET MVC.&lt;/p&gt;</description>
    </item>
    <item>
      <title>No aparece custom code activity para windows  workflow foundation en la barra de herramientas de Visual studio</title>
      <link>http://www.devjoker.com/contenidos/articulos/524/No-aparece-custom-code-activity-para-windows-workflow-foundation-en-la-barra-de-herramientas-de-Visual-studio.aspx</link>
      <description>&lt;p&gt;Un posible fallo que sucede con Workflow Foundation 4 o superior&amp;nbsp; y que no han corregido con la versión 2012 es que a veces cuando creamos una custom activity o custom code activity esta no aparece correctamente en la barra de herramientas (toolbox)&lt;/p&gt; &lt;p&gt;Este problema tiene fácil solución simplemente cerramos el visual studio y lo volvemos a abrir.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Como digo sucede tanto con Workflows 4.0 como con los nuevos basados en la versión 4.5 y parece más un problema de visual studio (en todas sus versiones) que de .net, afortunadamente sólo sucede a veces&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Saludos&lt;/p&gt; &lt;p&gt;Pablo.&lt;/p&gt;</description>
    </item>
    <item>
      <title>¿Es legal usar SQL server express en entornos de producción?</title>
      <link>http://www.devjoker.com/contenidos/articulos/523/Es-legal-usar-SQL-server-express-en-entornos-de-produccion.aspx</link>
      <description>&lt;p&gt;mucha gente tiende a pensar que la versión xpress es sólo para desarrollo pero en realidad puedes usarla en cualquier entorno siempre y cuanto no tengas problemas de tamaño, con SQL server xpress 2012 estás limitado a:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;1 Cpu (cuatro cores)  &lt;li&gt;1 GB de memoria ram  &lt;li&gt;10 GB de espacio por cada base de datos&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;No importa si tu servidor tiene más recursos, simplemente SQL server sólo usará esos como máximo.&lt;/p&gt; &lt;p&gt;Así mismo tampoco hay ningún problema en usar integration services o reporting services con la versión express (unicamente en&amp;nbsp; que ese caso necesitamos la versión express with advanced services)&lt;/p&gt; &lt;p&gt;Eso si, hay que tener en cuenta que&amp;nbsp; con la versión xpress tenemos las herramientas para &lt;strong&gt;ejecutar&lt;/strong&gt; reportes y paquetes ssis de integration pero no las herramientas para &lt;strong&gt;crearlos&lt;/strong&gt; ni para &lt;strong&gt;automatizarlos&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Es decir: si, es completamente legal usar SQL server versión&amp;nbsp; express en entornos de producción &lt;/p&gt; &lt;p&gt;Para más información sobre licencias podéis consultar en:&lt;/p&gt; &lt;p&gt;&lt;a title="http://www.microsoft.com/en-us/sqlserver/get-sql-server/how-to-buy.aspx" href="http://www.microsoft.com/en-us/sqlserver/get-sql-server/how-to-buy.aspx"&gt;http://www.microsoft.com/en-us/sqlserver/get-sql-server/how-to-buy.aspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Y para descargar la versión express podéis descargarla aquí:&lt;/p&gt; &lt;p&gt;&lt;a title="http://www.microsoft.com/en-us/download/details.aspx?id=29062" href="http://www.microsoft.com/en-us/download/details.aspx?id=29062"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=29062&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Un saludo, Pablo.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CMSMatrix–Comparador de gestores de contenidos on-line.</title>
      <link>http://www.devjoker.com/contenidos/articulos/522/CMSMatrix%e2%80%93Comparador-de-gestores-de-contenidos-on-line.aspx</link>
      <description>&lt;p&gt;Si has tenido que realizar la implantación del algún gestor de contenidos,&amp;nbsp; seguramente te has preguntado cual es el mejor para tu necesidades ¿Te conviene implantar Joomla!&amp;nbsp; o Wordpress?, ¿es mejor DotnetNuke o Umbraco, o quizas Orchard? ¿Son Open Source o de pago? …&lt;/p&gt; &lt;p&gt;En la web de CMSMatrix - &lt;a href="http://www.cmsmatrix.org/"&gt;http://www.cmsmatrix.org/&lt;/a&gt;, podemos comparar las caracteristicas de los sistemas de gestión de contenido más populares del mercado de forma fácil y rápida. &lt;/p&gt; &lt;p&gt;En la siguiente imagen podemos ver el resultado de la comparativa entre los CMS más populares para la plataforma .NET -&amp;nbsp; &lt;a href="http://www.dotnetnuke.com/"&gt;DotnetNuke&lt;/a&gt;, &lt;a href="http://umbraco.com/"&gt;Umbraco&lt;/a&gt; y &lt;a href="http://www.orchardproject.net/"&gt;Orchard&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/CMSMatrixComparador-de-sistemas-de_979E/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/CMSMatrixComparador-de-sistemas-de_979E/image_thumb.png" width="607" height="323"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Podemos realizar comparativas entre un monton de sistemas - algunos que seguro ni siquiera conoces!&lt;/p&gt; &lt;p&gt;En definitiva, un gran recurso que nos ayudará a tomar la mejor decisión a la hora de elegir un CMS.&lt;/p&gt; &lt;p&gt;Saludos, DJK!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Como montar un entorno de  sharepoint  2010 de forma simplificada (desarrollo y sistemas)</title>
      <link>http://www.devjoker.com/contenidos/articulos/521/Como-montar-un-entorno-de-sharepoint-2010-de-forma-simplificada-desarrollo-y-sistemas.aspx</link>
      <description>&lt;p&gt;Un enlace interesante para poder montar una máquina de sharepoint de forma simplificada.&lt;/p&gt; &lt;p&gt;&lt;a title="http://www.microsoft.com/en-us/download/details.aspx?id=23415" href="http://www.microsoft.com/en-us/download/details.aspx?id=23415"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=23415&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Es un script de power shell para facilitar toda la instalación, funciona tanto en máquinas normales como en máquinas virtuales.&lt;/p&gt; &lt;p&gt;Desgraciadamente sólo está la versión para 2010 , todavía no hay versión para 2013, tampoco incluye el visual Studio 2012 mucho más para desarrollar en la versión 2012 pero en cualquier caso simplifica bastante la instalación.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Reducir el tamaño del log de transacciones en SQL server</title>
      <link>http://www.devjoker.com/contenidos/articulos/520/Reducir-el-tama%c3%b1o-del-log-de-transacciones-en-SQL-server.aspx</link>
      <description>&lt;p&gt;Una pregunta típica en servidores SQL que usan el modo de restauración FULL o BULK es cómo reducir el tamaño del log de transacciones cuando este crece de forma anormal en SQL server 2008 o superior.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Normalmente el log se reduce sólo cuando hacemos un backup pero hay ocasiones en que esto no es así&lt;br&gt; y el log crece y crece .&lt;/p&gt; &lt;p&gt;Para evitarlo y reducir de nuevo el log tenemos que ejecutar el siguiente script:&lt;/p&gt; &lt;p&gt;&lt;font color="#9bbb59"&gt;-usamos la base de datos ficticia devjoker2013BD&lt;br&gt;--Primero hacemos un backup completo de la base de datos para evitar perder la información del log&lt;br&gt;--en caso de restauración hasta un punto en el tiempo&lt;/font&gt; &lt;/p&gt; &lt;p&gt;&lt;font color="#c0504d"&gt;BACKUP DATABASE devjoker2013BD&lt;br&gt;TO DISK = 'D:\SQLServerBackups\devjoker2013BD.Bak'&lt;br&gt;&amp;nbsp;&amp;nbsp; WITH FORMAT,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEDIANAME = 'D_SQLServerBackups',&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NAME = 'Backup completo de devjoker2013BD previo al truncado del log';&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#c0504d"&gt;GO&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#9bbb59"&gt;--cambiamos el modo del log de base de datos a SIMPLEALTER DATABASE devjoker2013BD&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#ff0000"&gt;&lt;font color="#c0504d"&gt;SET RECOVERY SIMPLE;&lt;br&gt;GO&lt;/font&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="#9bbb59"&gt;-- Comprimimos el log a un sólo MB de tamaño&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#c0504d"&gt;DBCC SHRINKFILE (devjoker2013BD_Log, 1);&lt;br&gt;GO&lt;/font&gt;&lt;br&gt;&lt;font color="#9bbb59"&gt;-- Volvemos a dejar el log en modo completo (o bulk logged si ese era el caso).&lt;/font&gt;&lt;br&gt;&lt;font color="#c0504d"&gt;ALTER DATABASE devjoker2013BD&lt;br&gt;SET RECOVERY FULL;&lt;br&gt;GO&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;br&gt;Nota: para que esta operación funcione al 100% es posible que tengamos que dejar temporalmente &lt;br&gt; la base de datos en modo monousuario (es decir sin acceso al mismo)&amp;nbsp; &lt;br&gt;para garantizar que no haya transacciones pendientes en el momento de hacer el truncado&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;En ese caso necesitaríamos un código como este:&lt;/p&gt; &lt;p&gt;&lt;font color="#c0504d"&gt;USE devjoker2013BD;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;br&gt;&lt;font color="#c0504d"&gt;GO&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;br&gt;&lt;font color="#c0504d"&gt;ALTER DATABASE AdventureWorks2012 SET SINGLE_USER WITH ROLLBACK IMMEDIATE;&lt;br&gt; GO ALTER DATABASE AdventureWorks2012 SET READ_ONLY;&lt;/font&gt; &lt;/p&gt; &lt;p&gt;&lt;font color="#9bbb59"&gt;--Realizamos el backup y el truncado del log&lt;br&gt;&lt;/font&gt;&lt;font color="#c0504d"&gt;GO &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#c0504d"&gt;ALTER DATABASE AdventureWorks2012 SET MULTI_USER;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Contrariamente a lo que podamos pensar a corto plazo no notaremos una mejora del rendimiento sino un empeoramiento ya que &lt;br&gt;tarde o temprano el log volverá a crecer hasta su tamaño optimo que supuestamente será menor que el tamaño anterior pero mayor de &lt;br&gt;1MB&amp;nbsp; que es el valor que especificamos anteriormente.&lt;/p&gt; &lt;p&gt;Una vez que el log tenga el tamaño optimo y no sobredimensionado si deberíamos notar una mejora del rendimiento aunque no siempre&lt;br&gt;será perceptible a simple vista.&lt;/p&gt; &lt;p&gt;Por esto último no deberíamos realizar esta operación como parte de un plan de mantenimiento sino cómo una operación puntual&lt;br&gt;cuando detectemos que el tamaño del log toma un tamaño exagerado y siempre después de un backup completo para evitar perdida de datos en caso&lt;br&gt;de tener que restaurar.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Solution Load Manager. Extension de Visual Studio para trabajar con soluciones de gran tamaño.</title>
      <link>http://www.devjoker.com/contenidos/articulos/519/Solution-Load-Manager-Extension-de-Visual-Studio-para-trabajar-con-soluciones-de-gran-tama%c3%b1o.aspx</link>
      <description>&lt;p&gt;Cuando trabajamos en Visual Studio con Soluciones de gran tamaño, lo mas habitual es que solo trabajemos al mismo tiempo con un pequeño número de proyectos, por lo que cargar y compilar todos los proyectos resulta una carga innecesaria. &lt;/p&gt; &lt;p&gt;Especialmente cuando trabajamos varios equipos, en una arquitectura bien estructurada en capas es muy habitual que existan especialistas web que solo trabajen con presentación, arquitectos que se ocupen de la infraestructura …&amp;nbsp; No obstante, cuando abrimos la solucion Visual Studio carga todos los proyectos (aunque no los vayamos a necesitar) y hace que nuestro trabajo sea mucho mas lento de lo que debería, y por lo tanto seamos mucho menos productivos.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/4e01f73bd2ad_CC89/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/4e01f73bd2ad_CC89/image_thumb.png" width="232" height="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Solution Load Manager es un excelente pluging de Visual Studio que nos va a permitir especificar que proyectos queremos cargar cuando abramos la solucion de Visual Studio. Además disponemos de la posibilidad de crear perfiles, de modo que podemos especificar facilmente que proyectos han de cargase en cada momento.&lt;/p&gt; &lt;p&gt;Podemos descargar Solution Load Manager desde este &lt;a href="http://visualstudiogallery.msdn.microsoft.com/66350dbe-ed01-4120-bea2-5564eff7b0b2"&gt;enlace&lt;/a&gt;. Una vez instalado se habita una nueva opción de menú contextual (boton derecho) de la solución.&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/4e01f73bd2ad_CC89/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/4e01f73bd2ad_CC89/image_thumb_1.png" width="244" height="181"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Este menú nos permitirá acceder a la pantalla de configuración de Solution Load Manager, desde donde podremos especificar que proyectos se deben cargar al abrir la solucion&lt;/p&gt; &lt;p&gt;&lt;a href="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/4e01f73bd2ad_CC89/image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://devjoker.com/images/UploadFiles/Windows-Live-Writer/4e01f73bd2ad_CC89/image_thumb_2.png" width="244" height="205"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Simplemente marcando los proyectos&amp;nbsp; y utilizando los botones de color de la parte superior de la interfaz podemos especificar como han de cargarse los proyectos al abrir la solucion. La opciones permitidas son:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Cargar el proyecto por defecto al abrir la Solucion.&lt;/li&gt; &lt;li&gt;Carga en segundo plano.&lt;/li&gt; &lt;li&gt;Cargar el proyecto si es necesario.&lt;/li&gt; &lt;li&gt;Carga explicita.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Una vez realizadas las modificaciones, recargaremos la solución con solo los proyectos necesarios para nuestro trabajo. Espero que os sea de tanto utilidad como me ha sido a mi.&lt;/p&gt; &lt;p&gt;Saludos, &lt;/p&gt; &lt;p&gt;DJK&lt;/p&gt;</description>
    </item>
    <item>
      <title>Fundamentos de funcionamiento de una aplicación web</title>
      <link>http://www.devjoker.com/contenidos/articulos/518/Fundamentos-de-funcionamiento-de-una-aplicacion-web.aspx</link>
      <description>&lt;h2&gt;Arquitectura cliente-servidor y modelo de petición - respuesta&lt;/h2&gt; &lt;p&gt;Antes de poder entrar a ver como se programa una aplicación con ASP.NET es necesario conocer algunos de los fundamentos de funcionamiento de una aplicación web.&lt;/p&gt; &lt;p&gt;Los primero que debemos saber es que las aplicaciones web se basan en una arquitectura cliente-servidor. Donde:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;El servidor&lt;/strong&gt; es el ordenador encargado de proporcionar el contenido. Para ello necesitamos instalar un servidor web en dicha máquina. Existen multitud de servidores web (&lt;a href="http://es.wikipedia.org/wiki/Servidor_HTTP_Apache"&gt;Apache&lt;/a&gt;, &lt;a href="http://es.wikipedia.org/wiki/Lighttpd"&gt;LigHTTPd&lt;/a&gt;, &lt;a href="http://es.wikipedia.org/wiki/IIS"&gt;IIS&lt;/a&gt;) pero no todos son capaces de ejecutar aplicaciones ASP.NET. Únicamente los servidores de Microsoft pueden desempeñar dicha tarea. En nuestro caso utilizaremos &lt;a href="http://www.microsoft.com/es-es/download/details.aspx?id=1038"&gt;IIS Espress&lt;/a&gt;.  &lt;li&gt;&lt;strong&gt;El cliente&lt;/strong&gt;, que es el encargado de solicitar la información al servidor y mostrarla al usuario. Es el navegador (Interner Explorer, Firefox, Chrome, etc ). Si estas viendo está pagina estas utilizando un navegador web.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;El funcionamiento de una aplicación es simple, el cliente emite una petición de un recurso que se encuentra en el servidor, y el servidor devuelve el recurso solicitado que es mostrado por el navegador.&lt;/p&gt; &lt;p align="center"&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_thumb_2.png" width="244" height="100"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;La petición del recurso en concreto se realiza a través de una &lt;a href="http://es.wikipedia.org/wiki/Url"&gt;URL&lt;/a&gt;. Una URL no es mas que una cadena de texto, expresada en un formato determinado en la que indicamos el protocolo, el puerto, el servidor y el recurso que estamos solicitando. Por ejemplo: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://www.devjoker.com:80/default.aspx"&gt;http://www.devjoker.com:80/default.aspx&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;En nuestro caso el protocolo es HTTP, el servidor &lt;a href="http://www.devjoker.com"&gt;www.devjoker.com&lt;/a&gt;, el puerto el 80 y el recurso default.aspx. El puerto estándar para el protocolo HTTP es el 80, por lo que no se suele especificar. Dependiendo de la configuración del servidor podríamos omitir el recurso y asignar uno por defecto. De este modo la siguiente URL seria equivalente a esta otra:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://www.devjoker.com"&gt;http://www.devjoker.com&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;La petición HTTP tendría la siguiente forma:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;GET &lt;/font&gt;&lt;/em&gt;&lt;a href="http://www.devjoker.com/"&gt;&lt;em&gt;&lt;font color="#808080"&gt;http://www.devjoker.com/&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;font color="#808080"&gt; HTTP/1.1&lt;br&gt;Accept: text/html, application/xhtml+xml, */*&lt;br&gt;Accept-Language: es-ES&lt;br&gt;User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)&lt;br&gt;Accept-Encoding: gzip, deflate&lt;br&gt;Host: www.devjoker.com&lt;br&gt;If-Modified-Since: Fri, 03 Aug 2012 10:57:59 GMT&lt;br&gt;Connection: Keep-Alive&lt;br&gt;Pragma: no-cache&lt;br&gt;Cookie: ASP.NET_SessionId=nullimt1wzjmbtik5ferit4w;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Aunque nosotros solo especifiquemos la URL, el navegador web añadirá cierta información adicional a la petición como el tipo de contenido que acepta como respuesta, el lenguaje, tipo de navegador …  &lt;p&gt;Y la respuesta sería algo similar a esto (se acorta el contenido del documento HTML devuelto por razones de espacio):  &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;&lt;font color="#8a8a8a"&gt;HTTP/1.1 200 OK&lt;br&gt;Cache-Control: public&lt;br&gt;Content-Type: text/html; charset=utf-8&lt;br&gt;Expires: Fri, 03 Aug 2012 10:58:48 GMT&lt;br&gt;Last-Modified: Fri, 03 Aug 2012 10:58:38 GMT&lt;br&gt;Vary: Accept-Encoding&lt;br&gt;Server: Microsoft-IIS/7.5&lt;br&gt;X-AspNet-Version: 4.0.30319&lt;br&gt;X-Powered-By: ASP.NET&lt;br&gt;Date: Fri, 03 Aug 2012 10:58:39 GMT&lt;br&gt;Content-Length: 42013&lt;/font&gt;&lt;/em&gt;  &lt;p&gt;&amp;lt;!DOCTYPE html &amp;gt;&lt;br&gt;&amp;lt;html lang="es"&amp;gt;&lt;br&gt;&amp;lt;head id="Head1"&amp;gt;&lt;br&gt;&amp;lt;title&amp;gt;www.devjoker.com&amp;lt;/title&amp;gt;&lt;br&gt;&amp;lt;/head&amp;gt;&lt;br&gt;&amp;lt;body&amp;gt;&lt;br&gt;&lt;font color="#c0c0c0"&gt;&amp;lt;!-- Contenido de la página!!!! --&amp;gt;&lt;br&gt;....&lt;/font&gt;&lt;br&gt;&amp;lt;/body&amp;gt;&lt;br&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Tanto la petición como la respuesta pueden tener dos secciones diferenciadas: Las cabeceras de HTTP (indicadas en cursiva y color gris en el ejemplo) y el cuerpo. Profundizaremos algo más en estos conceptos en capítulos posteriores de este tutorial. De momento diremos que en el caso de la petición HTTP podemos enviar información adicional (normalmente los datos de un formulario web), y que en el caso de la respuesta HTTP recibiremos el contenido HTML, el lenguaje de marcado que utilizará el navegador para visualizar la página.&lt;/p&gt; &lt;p&gt;Afortunadamente ASP.NET (y todos los framework de desarrollo web) encapsulan el manejo de la solicitud y la respuesta en objetos de fácil acceso.&lt;/p&gt; &lt;h2&gt;Servidores DNS&lt;/h2&gt; &lt;p&gt;Falta aún por introducir un elemento importante. Los servidores en internet (en realidad cualquier ordenador dentro de una red) se identifica por una &lt;a href="http://es.wikipedia.org/wiki/Direcci%C3%B3n_IP"&gt;direccion IP&lt;/a&gt;. Sin embargo, en el ejemplo anterior, al proporcionar la URL, no nos hemos referido a una dirección IP, sino al nombre del servidor (mas concretamente al nombre de “dominio”). Entonces … ¿Como sabe el navegador que un determinado servidor “www.devjoker.com” se corresponde con una dirección IP concreta? La respuesta es simple: Los &lt;a href="http://es.wikipedia.org/wiki/Domain_Name_System"&gt;servidores DNS&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Un servidor DNS es una especie de “centralita de internet”, de forma que cuando un navegador solicita una URL a un servidor desconocido, primero se consulta la “centralita” para obtener la dirección IP. Por motivos de rendimiento, una vez que se ha resuelto el nombre de dominio se almacena localmente para que no sea necesario volver a preguntar.&lt;/p&gt; &lt;p align="center"&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_thumb_3.png" width="244" height="192"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Podemos realizar consultas directamente al servidor DNS con la aplicación nslookup:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Microsoft Windows [Versión 6.1.7601]&lt;br&gt;Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.  &lt;p&gt;C:\Users\pedro_herrarte&amp;gt;nslookup&lt;br&gt;Servidor predeterminado: google-public-dns-a.google.com&lt;br&gt;Address: 8.8.8.8  &lt;p&gt;&amp;gt; devjoker.com&lt;br&gt;Servidor: google-public-dns-a.google.com&lt;br&gt;Address: 8.8.8.8  &lt;p&gt;Respuesta no autoritativa:&lt;br&gt;Nombre: devjoker.com&lt;br&gt;Address: 188.165.132.77  &lt;p&gt;&amp;gt; 188.165.132.77&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;En el ejemplo anterior estamos utilizando los servidores DNS de Google (IP 8.8.8.8). &lt;/p&gt; &lt;p&gt;Por ultimo, nos faltaría conocer como es capaz el servidor DNS de obtener la IP correcta de nuestro servidor &lt;a href="http://www.devjoker.com"&gt;www.devjoker.com&lt;/a&gt;. Cuando registramos un dominio en internet, debemos configurar dicha información a través del panel de control DNS (opción que proveen TODOS los registradores de dominio … ¿TODOS? NO! &lt;strong&gt;&lt;a href="http://www.movistar.es/"&gt;MoviStar&lt;/a&gt; no te permite configurar los registros de DNS y te obliga a contratarlo como servicio aparte. Mi recomendación es que NUNCA registréis un dominio con &lt;a href="http://www.movistar.es/"&gt;MoviStar&lt;/a&gt;&lt;/strong&gt;). De este modo, publicamos que nuestro nombre de dominio “devjoker.com”, se corresponde un servidor (o conjunto de servidores) con una dirección IP concreta.&lt;/p&gt; &lt;p&gt;La siguiente imagen muestra la configuración DNS de devjoker.com:&lt;/p&gt; &lt;p align="center"&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_thumb_4.png" width="229" height="244"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;De un modo similar funciona el envío de correos electrónicos, con las salvedad de que el servidor DNS es consultado para registros de tipo MX – Mail eXchange, es decir, que para que nuestro servidor sea capaz de enviar y recibir correos debemos haber configurado correctamente ambos servidores y haber configurado los servidores DNS adecuadamente.&lt;/p&gt; &lt;h2&gt;Protocolo HTTP&lt;/h2&gt; &lt;p&gt;El protocolo de comunicaciones que se utiliza para solicitar y recibir páginas web es &lt;a href="http://es.wikipedia.org/wiki/HTTP"&gt;HTTP&lt;/a&gt;. HTTP es el acrónimo de &lt;strong&gt;HyperText Transfer Protocol, &lt;/strong&gt;siendo el aspecto mas relevante que se trata de un protocolo de transmisión de texto. &lt;strong&gt;Solo texto&lt;/strong&gt;. Es sumamente importante entender este aspecto, ya que condiciona como funciona la web.&lt;/p&gt; &lt;p&gt;Si analizamos los elementos base en los que sostiene la web hoy en día, nos encontramos los siguientes elementos fundamentales:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;El lenguaje para la definición de los elementos de una página y su contenido es texto – HTML. Veremos una pequeña introducción a HTML en el siguiente capitulo.  &lt;li&gt;El lenguaje para la definición del aspecto visual de la página es texto. CSS. También veremos una introducción a CSS en este tutorial.  &lt;li&gt;El lenguaje para la programación del lado del cliente JavaScript, que se recibe en cuerpo de la respuesta como texto, y se compila e interpreta en el cliente. (Esto tiene interesantes matices, como la posibilidad de escribir código dinámicamente en el servidor …)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;HTTP es un protocolo sin estado&lt;/strong&gt;, es decir, HTTP no guarda ninguna información sobre conexiones anteriores. Esto significa que cuando enviamos varias solicitudes HTTP, la solicitud actual no conoce en los datos que han enviado y recibido las peticiones anteriores. &lt;/p&gt; &lt;p&gt;Por ejemplo, si en una primera solicitud enviamos la información de un usuario, y luego visitamos una segunda página, esta segunda página no sabe que usuario utilizamos en la anterior. Este es un factor que condiciona completamente la forma de trabajar cuando desarrollamos aplicaciones web, ya que al no proporcionarnos esta información el protocolo vamos a tener que realizarlo a nivel de aplicación.&lt;/p&gt; &lt;p&gt;Además las peticiones HTTP responden a una serie de “verbos” predefinidos, según el verbo de la solicitud el servidor actuará de una forma u otra. Los verbos mas comunes son GET y POST, aunque existen mas. Veremos mas adelante que ASP.NET MVC permite especificar que un método de un controlador responda únicamente a un conjunto de verbos concretos.&lt;/p&gt; &lt;p&gt;Cuando veamos la parte dedicada a &lt;a href="http://www.devjoker.com/contenidos/catss/387/Aprende-Ajax-desde-cero.aspx"&gt;AJAX&lt;/a&gt; y &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; veremos que existen métodos $.get() y $.post() para realizar peticiones utilizando uno u otro verbo de forma simple desde JavaScript.&lt;/p&gt; &lt;p&gt;Ha continuación vamos a ver un par de ejemplos sobre GET y POST.&lt;/p&gt; &lt;blockquote&gt; &lt;dl&gt; &lt;dt&gt;GET  &lt;dd&gt;Solicita un recurso especifico. Se utiliza sobre todo cuando solicitamos un recurso sin necesidad de enviar información adicional, aunque el verbo GET permite enviar datos adicionales como parte de la URL solicitada, su uso debe realizarse con cuidado, ya que es una información que un usuario malintencionado podría modificar para realizar un ataque.  &lt;dd&gt;&lt;tt&gt;&lt;/tt&gt; &lt;dd&gt;&lt;tt&gt;GET /images/logo.png HTTP/1.1&lt;/tt&gt; obtiene un recurso llamado logo.png&lt;/dd&gt;&lt;/dl&gt; &lt;dl&gt; &lt;dt&gt;POST  &lt;dd&gt;Envía los datos incluyéndolos en el cuerpo de la petición. Es muy habitual para el envío de datos (a través de formularios), en los que el usuario rellena cierta información y la envía al servidor.  &lt;dd&gt;&lt;span lang="ES-MODERN"&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;POST &lt;/em&gt;&lt;/font&gt;&lt;a href="http://devjoker.com/login.aspx"&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;http://devjoker.com/login.aspx&lt;/em&gt;&lt;/font&gt;&lt;/a&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt; HTTP/1.1&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Accept: text/html, application/xhtml+xml, */*&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Accept-Language: es-ES&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Content-Type: application/x-www-form-urlencoded&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Accept-Encoding: gzip, deflate&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Host: devjoker.com&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Content-Length: 650&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Connection: Keep-Alive&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#808080" face="Courier New"&gt;&lt;em&gt;Pragma: no-cache&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;/span&gt;&lt;span lang="ES-MODERN"&gt;&lt;font face="Courier New"&gt;UserName=nombreUsuario&amp;amp;Password=laclave&lt;/font&gt;&lt;/p&gt;&lt;/span&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/blockquote&gt; &lt;p&gt;El ejemplo anterior corresponde a la captura de una petición HTTP de un formulario de identificación de usuario a través de POST. Podemos ver que la información se envía en el cuerpo de la petición, y fácilmente podemos obtener el usuario y el password, siendo muy fáciles de capturar (al menos desde el propio equipo que realiza las peticiones!). Es por este motivo, por el &lt;strong&gt;existe una versión cifrada de HTTP – HTTPS &lt;/strong&gt;–, que se encarga de cifrar todas comunicaciones que se producen entre el navegador y el servidor. Es un aspecto que tendremos que tener en cuenta siempre que nuestras aplicaciones requieran del manejo de datos sensibles.&lt;/p&gt; &lt;p&gt;Por último, comentar que HTTP responde a cada petición con un código de estado predefinido que permite al navegador identificar que acción debe realizar. A continuación vamos a ver algunos de los códigos HTTP mas comunes.&lt;/p&gt; &lt;h3&gt;Códigos de estado HTTP.&lt;/h3&gt; &lt;p&gt;Cada respuesta &lt;strong&gt;HTTP&lt;/strong&gt; identifica el resultado de la petición a través de un código HTTP. Dependiendo de este código de respuesta de HTTP el navegador realizará una acción u otra. Por ejemplo, mostrará la pantalla solicitada si el estado es 200 (OK) o mostrará la pantalla de error en caso de que reciba un error 500 (error de servidor).&lt;/p&gt; &lt;p&gt;Los códigos de error de HTTP con códigos numéricos, agrupados en familias por centenas. De forma que los errores 200 corresponden a peticiones correctas, los errores 300 redirecciones, los 400 errores en la petición y los errores 500 errores de ejecución del lado del servidor.&lt;/p&gt; &lt;p&gt;De manera muy breve veremos los principales códigos de respuesta de HTTP.&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;200&lt;/strong&gt; &lt;strong&gt;OK&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;Indica que el servidor a obtenido y enviado correctamente el recurso solicitado por la petición. En este caso el cuerpo de la respuesta contendrá el contenido en texto (HTML, CSS, Javascript, etc) del recurso solicitado, permitiendo al navegador mostrarlo en la pantalla.&lt;/p&gt; &lt;p&gt;El siguiente ejemplo muestra una petición GET al recurso http://devjoker.com :&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;GET &lt;a href="http://devjoker.com/"&gt;http://devjoker.com/&lt;/a&gt; HTTP/1.1&lt;br&gt;Accept: text/html, application/xhtml+xml, */*&lt;br&gt;Accept-Language: es-ES&lt;br&gt;User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)&lt;br&gt;Accept-Encoding: gzip, deflate&lt;br&gt;Host: devjoker.com&lt;br&gt;If-Modified-Since: Sun, 19 Aug 2012 22:22:57 GMT&lt;br&gt;Connection: Keep-Alive&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Y la respuesta obtenida:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;HTTP/1.1 200 OK&lt;br&gt;Cache-Control: public, max-age=10&lt;br&gt;Content-Type: text/html; charset=utf-8&lt;br&gt;Content-Encoding: gzip&lt;br&gt;Expires: Sat, 22 Sep 2012 22:37:05 GMT&lt;br&gt;Last-Modified: Sat, 22 Sep 2012 22:36:55 GMT&lt;br&gt;Vary: Accept-Encoding&lt;br&gt;Server: Microsoft-IIS/7.5&lt;br&gt;X-AspNet-Version: 4.0.30319&lt;br&gt;X-Powered-By: ASP.NET&lt;br&gt;Date: Sat, 22 Sep 2012 22:36:56 GMT&lt;br&gt;Content-Length: 9357  &lt;p&gt;&amp;lt;html&amp;gt;  &lt;p&gt;…  &lt;p&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;La respuesta incluye el código HTML de la página que permitirá al navegador mostrar el contenido solicitado. Por razones de espacio se omite el contenido HTML en este ejemplo.&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;301&lt;/strong&gt; &lt;strong&gt;Redirección permanentemente&lt;/strong&gt;.&lt;/h4&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;Ésta es la opción más habitual en el caso de migraciones o cambios de dominio, indica al navegador que el recurso solicitado no ha cambiado de ubicación y que debe solicitar una nueva &lt;span class="caps"&gt;URL. &lt;/span&gt;Además le insta a modificar cualquier enlace que conserve almacenado o información asociada a dicha &lt;span class="caps"&gt;URL&lt;/span&gt; (como por ejemplo, el índice de Google o Bing). Una redirección &lt;strong&gt;301&lt;/strong&gt; es interpretada por los motores de búsqueda de forma que implica que &lt;strong&gt;toda la información asociados a la página original se transmitan a la de destino&lt;/strong&gt;, por lo que es el más aconsejable para trasladar contenido.&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;302&lt;/strong&gt; &lt;strong&gt;Found.&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;Indica que un recurso ha sido localizado pero que no ha sido devuelto como parte de la respuesta, indicando una nueva localización para el recurso.&lt;strong&gt; &lt;/strong&gt;Está es la opción que se utiliza cuando queremos efectuar la redirección de un recurso a otro diferente. El código &lt;strong&gt;302&lt;/strong&gt; &lt;strong&gt;se suele usar para todos los traslados temporales&lt;/strong&gt;, donde el servidor responde al navegador indicándole una nueva URL con el nuevo recurso. Es el navegador el que interpreta este código y realiza una nueva petición (esta vez al nuevo recurso). El siguiente ejemplo muestra una respuesta&lt;strong&gt; HTTP 302&lt;/strong&gt; en la que navegador redirecciona a un nuevo recurso (Location: /private/index.aspx)&lt;/p&gt;&lt;span lang="ES-MODERN"&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Courier New"&gt;HTTP/1.1 302 Found&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;Cache-Control: private, no-cache="Set-Cookie"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;Content-Type: text/html; charset=utf-8&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;Location: /private/index.aspx&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;También Es muy común utilizar el código 302 para controlar la navegación dentro de un sitio web.&lt;/p&gt;&lt;/span&gt; &lt;h4&gt;&lt;strong&gt;304&lt;/strong&gt; &lt;strong&gt;Not Modified.&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;Básicamente indica que &lt;strong&gt;el contenido no se ha modificado&lt;/strong&gt; desde la última vez que se solicitó. Lo mas normal es que nunca se provoque este estado a propósito, sino que dejemos al servidor decida cuando usarlo. La consecuencia directa en que cuando un navegador recibe esté código, la respuesta no contiene contenido alguno es el cuerpo – el recurso se obtendrá del los archivos temporales almacenados por el navegador en peticiones anteriores. Por ejemplo, si una página no se ha modificado, no se transmite de nuevo el contenido de la misma, simplemente se indica que no se ha modificado a través del código 304 y el navegador utiliza la última versión de la que dispone.&lt;/p&gt;&lt;span lang="ES-MODERN"&gt; &lt;blockquote&gt; &lt;p dir="ltr"&gt;HTTP/1.1 304 Not Modified&lt;/p&gt; &lt;p dir="ltr"&gt;Last-Modified: Mon, 06 Aug 2012 17:12:08 GMT&lt;/p&gt; &lt;p dir="ltr"&gt;Accept-Ranges: bytes&lt;/p&gt; &lt;p dir="ltr"&gt;ETag: "35ec559cf673cd1:0"&lt;/p&gt; &lt;p dir="ltr"&gt;Server: Microsoft-IIS/7.5&lt;/p&gt; &lt;p dir="ltr"&gt;X-Powered-By: ASP.NET&lt;/p&gt; &lt;p&gt;Date: Sat, 22 Sep 2012 22:36:58 GMT&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Podemos entender mejor este código de estado si pensamos en una imagen que se muestra en una página web, la primera vez que visitamos la página el servidor nos entrega la imagen, pero en peticiones sucesivas se detecta que la imagen no se ha modificado y se utiliza la versión que se descargo la ultima vez.&lt;/p&gt;&lt;/span&gt; &lt;h4&gt;&lt;strong&gt;400&lt;/strong&gt; &lt;strong&gt;Bad Request&lt;/strong&gt;.&lt;/h4&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;Este código indica que la solicitud no está correctamente formada. Normalmente se produce este error cuando la URL no es correcta.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Courier New"&gt;HTTP/1.1 400 Bad Request&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Otros errores de la familia 400 son:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; No autorizado  &lt;li&gt;&lt;strong&gt;402&lt;/strong&gt; Pago requerido  &lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Prohibido&lt;/li&gt;&lt;/ul&gt; &lt;h4&gt;&lt;strong&gt;404&lt;/strong&gt; &lt;strong&gt;Not Found&lt;/strong&gt;.&lt;/h4&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;Sin lugar a dudas el error mas común. Indica que a pesar de que la petición es correcta el recurso solicitado no existe en el servidor. Normalmente esto se produce debido a que la URL apunta a un recurso que no existe en el servidor, pero también es posible que el servidor este ocultando el recurso intencionadamente.&lt;/p&gt;&lt;span lang="ES-MODERN"&gt; &lt;blockquote&gt; &lt;p dir="ltr"&gt;HTTP/1.1 404 Not Found&lt;/p&gt; &lt;p dir="ltr"&gt;Content-Type: text/html&lt;/p&gt; &lt;p dir="ltr"&gt;Server: Microsoft-IIS/7.5&lt;/p&gt; &lt;p dir="ltr"&gt;X-Powered-By: ASP.NET&lt;/p&gt; &lt;p dir="ltr"&gt;Date: Sat, 22 Sep 2012 22:51:04 GMT&lt;/p&gt; &lt;p&gt;Content-Length: 1245&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;También se puede producir un error 404 cuando el servidor no tiene configurado el tipo de recurso correctamente.&lt;/p&gt;&lt;/span&gt;&lt;span lang="ES-MODERN"&gt;&lt;/span&gt; &lt;h4&gt;&lt;strong&gt;405&lt;/strong&gt; &lt;strong&gt;Method Not Allowed&lt;/strong&gt;.&lt;/h4&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;Este código indica que el verbo utilizado en la petición no es válido. Se incluye como parte de la respuesta los verbos admitidos por el recurso.&lt;/p&gt;&lt;span lang="ES-MODERN"&gt; &lt;blockquote&gt; &lt;p dir="ltr"&gt;&lt;font face="Courier New"&gt;HTTP/1.1 405 Method Not Allowed&lt;/font&gt;&lt;/p&gt; &lt;p dir="ltr"&gt;&lt;font face="Courier New"&gt;Allow: GET, HEAD, OPTIONS, TRACE&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;Content-Type: text/html&lt;/font&gt;&lt;/span&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;h4&gt;&lt;strong&gt;500 Server Error&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;La familia de errores 500 corresponden con errores de servidor. Se pueden deber a multitud de causas, ya que suelen corresponder con un error de nuestra aplicación. Por ejemplo, si en nuestro programa cometemos un error de programación e intentamos realizar una división por cero, el cliente recibirá un error 500 como resultado de la respuesta.&lt;/p&gt; &lt;p&gt;También se produce un error 500 cuando el servidor no dispone de los recursos necesarios para atender la petición.&lt;/p&gt; &lt;p&gt;El siguiente ejemplo muestra un ejemplo de petición a devjoker.com en el que hemos detenido intencionadamente la aplicación. En este caso obtenemos un error con código 503 que nos indica que la aplicación no está disponible – 503 Service Unavaileable.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;GET &lt;a href="http://devjoker.com/"&gt;http://devjoker.com/&lt;/a&gt; HTTP/1.1&lt;br&gt;Accept: text/html, application/xhtml+xml, */*&lt;br&gt;Accept-Language: es-ES&lt;br&gt;User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)&lt;br&gt;Accept-Encoding: gzip, deflate&lt;br&gt;Host: devjoker.com&lt;br&gt;Connection: Keep-Alive  &lt;p&gt;-----------------------------------------------------------------------------------------------------------------------------------  &lt;p&gt;HTTP/1.1 503 Service Unavailable&lt;br&gt;Content-Type: text/html; charset=us-ascii&lt;br&gt;Server: Microsoft-HTTPAPI/2.0&lt;br&gt;Date: Sat, 06 Oct 2012 15:41:03 GMT&lt;br&gt;Connection: close&lt;br&gt;Content-Length: 326  &lt;p&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""&lt;a href="http://www.w3.org/TR/html4/strict.dtd&amp;quot;"&gt;http://www.w3.org/TR/html4/strict.dtd"&lt;/a&gt;&amp;gt;&lt;br&gt;&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;&amp;lt;TITLE&amp;gt;Service Unavailable&amp;lt;/TITLE&amp;gt;&lt;br&gt;&amp;lt;META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"&amp;gt;&amp;lt;/HEAD&amp;gt;&lt;br&gt;&amp;lt;BODY&amp;gt;&amp;lt;h2&amp;gt;Service Unavailable&amp;lt;/h2&amp;gt;&lt;br&gt;&amp;lt;hr&amp;gt;&amp;lt;p&amp;gt;HTTP Error 503. The service is unavailable.&amp;lt;/p&amp;gt;&lt;br&gt;&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;strong&gt;&lt;/strong&gt; &lt;p&gt;Los errores 500 definidos son: &lt;strong&gt;501&lt;/strong&gt; No implementado, &lt;strong&gt;502&lt;/strong&gt; Pasarela incorrecta, &lt;strong&gt;503&lt;/strong&gt; Servicio no disponible, &lt;strong&gt;504&lt;/strong&gt; Tiempo de espera de la pasarela agotado y &lt;strong&gt;505&lt;/strong&gt; version not suported.&lt;br&gt;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;505&lt;/strong&gt; &lt;strong&gt;HTTP Version Not Supported&lt;/strong&gt;.&lt;/h4&gt; &lt;p&gt;Este error se produce cuando la petición solicita una versión de HTTP no soportada por el servidor. El siguiente ejemplo muestra una petición HTTP 2.0, y el error devuelto indicando que el servidor no soporta esta versión de HTTP.&lt;/p&gt; &lt;blockquote&gt;&lt;span lang="ES-MODERN"&gt; &lt;p&gt;&lt;font face="Courier New"&gt;GET http://www.devjoker.com/ HTTP/2.0&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;Host: &lt;/font&gt;&lt;a href="http://www.devjoker.com"&gt;&lt;font face="Courier New"&gt;www.devjoker.com&lt;/font&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;-------------------------------------------------------------------&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;HTTP/1.1 505 HTTP Version Not Supported&lt;br&gt;Content-Type: text/html; charset=us-ascii&lt;br&gt;Server: Microsoft-HTTPAPI/2.0&lt;/font&gt;&lt;/p&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span lang="ES-MODERN"&gt; &lt;p&gt;Un estudio mas detallado del HTTP escapa completamente del ámbito de este tutorial donde solo pretendemos dar una breve introducción para facilitar los conceptos de programación con ASP.NET MVC que veremos en capítulos posteriores.&lt;/p&gt; &lt;h2&gt;Analizar el trafico HTTP.&lt;/h2&gt; &lt;p&gt;Si queremos analizar el tráfico HTTP directamente podemos hacerlo directamente utilizando las herramientas de desarrollo que incorporan casi todos los navegadores (pulsando F12), o bien a través de herramientas especificas como &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;La siguiente imagen muestra Fiddler utilizado para capturar el tráfico.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_8.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.devjoker.com/images/UploadFiles/WindowsLiveWriter/Orden10Fundamentosdefuncionamientodeunaa_FFDC/image_thumb_5.png" width="244" height="181"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/span&gt;</description>
    </item>
  </channel>
</rss>