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

<channel>
	<title>THE .NET WAY &#187; ASP.NET &#8211;  &#8211; The .Net Way</title>
	<atom:link href="http://www.thedotnetway.net/tag/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedotnetway.net</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 14:05:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rest Services JSON y XML con ASP.NET MVC</title>
		<link>http://www.thedotnetway.net/2011/05/19/rest-services-json-y-xml-con-asp-net-mvc/</link>
		<comments>http://www.thedotnetway.net/2011/05/19/rest-services-json-y-xml-con-asp-net-mvc/#comments</comments>
		<pubDate>Thu, 19 May 2011 12:38:43 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Json]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Rest]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/2011/05/19/rest-services-json-y-xml-con-asp-net-mvc/</guid>
		<description><![CDATA[Aquí dejo un ejemplo de como usar MVC para hacer servicios rest utilizando diferentes formatos para transportar los datos, para la serializacion Json utilizo la librería Json.NET, es la única dependencia. Las url de los servicios de este ejemplo serán estas: http://localhost/RestServices/MyClass/All.json http://localhost/RestServices/MyClass/All.xml http://localhost/RestServices/MyClass/Get/1.json http://localhost/RestServices/MyClass/Get/1.xml http://localhost/RestServices/MyClass/GetByName/Nombre%201.json http://localhost/RestServices/MyClass/GetByName/Nombre%201.xml http://localhost/RestServices/MyClass/Put.json http://localhost/RestServices/MyClass/Put.xml http://localhost/RestServices/MyClass/Delete.json http://localhost/RestServices/MyClass/Delete.xml Lo único que tienes<a class="rmore" href="http://www.thedotnetway.net/2011/05/19/rest-services-json-y-xml-con-asp-net-mvc/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><font color="#000000">Aquí dejo un ejemplo de como usar MVC para hacer servicios rest utilizando diferentes formatos para transportar los datos, para la serializacion Json utilizo la librería </font><a href="http://json.codeplex.com/" target="_blank"><font color="#000000">Json.NET</font></a><font color="#000000">, es la única dependencia.</font></p>
<p><font color="#000000">Las url de los servicios de este ejemplo serán estas:</font></p>
<ul>
<li>http://localhost/RestServices/MyClass/All.json </li>
<li>http://localhost/RestServices/MyClass/All.xml </li>
<li>http://localhost/RestServices/MyClass/Get/1.json </li>
<li>http://localhost/RestServices/MyClass/Get/1.xml </li>
<li>http://localhost/RestServices/MyClass/GetByName/Nombre%201.json </li>
<li>http://localhost/RestServices/MyClass/GetByName/Nombre%201.xml </li>
<li>http://localhost/RestServices/MyClass/Put.json </li>
<li>http://localhost/RestServices/MyClass/Put.xml </li>
<li>http://localhost/RestServices/MyClass/Delete.json </li>
<li>http://localhost/RestServices/MyClass/Delete.xml </li>
</ul>
<p><font color="#161f04">Lo único que tienes que hacer es crear un nuevo proyecto MVC, modificar el Global.asax con las rutas y añadir el controlador.</font></p>
<p><font color="#161f04">El código de ejemplo:</font></p>
<p><font color="#161f04">Esta clase es de ayuda para el ejemplo, nada especial <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </font></p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyClassHelper</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> List&lt;MyClass&gt; DataList = <span style="color: #0000ff">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyClass</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Id { get; set; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;MyClass&gt; Data </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        get </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (DataList == <span style="color: #0000ff">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                DataList = <span style="color: #0000ff">new</span> List&lt;MyClass&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 10; i++)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    DataList.Add(<span style="color: #0000ff">new</span> MyClass { Id = i.ToString(), Name = <span style="color: #006080">&quot;Nombre &quot;</span> + i });</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> DataList;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> MyClassToXml(MyClass c)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        XmlSerializer ser = <span style="color: #0000ff">new</span> XmlSerializer(<span style="color: #0000ff">typeof</span>(MyClass));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        StringWriter sw = <span style="color: #0000ff">new</span> StringWriter();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        ser.Serialize(sw, c);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        sw.Flush();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        sw.Close();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> sw.ToString();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> MyClassToXml(List&lt;MyClass&gt; c)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        XmlSerializer ser = <span style="color: #0000ff">new</span> XmlSerializer(<span style="color: #0000ff">typeof</span>(List&lt;MyClass&gt;));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        StringWriter sw = <span style="color: #0000ff">new</span> StringWriter();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        ser.Serialize(sw, c);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        sw.Flush();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        sw.Close();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> sw.ToString();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> MyClass XmlToMyClass(<span style="color: #0000ff">string</span> xml)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        StringReader sr = <span style="color: #0000ff">new</span> StringReader(xml);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        XmlSerializer ser = <span style="color: #0000ff">new</span> XmlSerializer(<span style="color: #0000ff">typeof</span>(MyClass));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> (MyClass)ser.Deserialize(sr);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> MyClassToJson(MyClass c)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> JsonConvert.SerializeObject(c);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> MyClassToJson(List&lt;MyClass&gt; c)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> JsonConvert.SerializeObject(c);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> MyClass JsonToMyClass(<span style="color: #0000ff">string</span> Json)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> JsonConvert.DeserializeObject&lt;MyClass&gt;(Json);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p><font color="#000000">Esta es la clase del Global.asax, aquí es donde se definen las rutas, veas que hay dos, una para el All, Put y Delete y otra para el Get y GetByName, con el id</font></p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> RegisterRoutes(RouteCollection routes)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    routes.IgnoreRoute(<span style="color: #006080">&quot;{resource}.axd/{*pathInfo}&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    routes.MapRoute(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">       <span style="color: #006080">&quot;Default&quot;</span>, <span style="color: #008000">// Route name</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">       <span style="color: #006080">&quot;{controller}/{action}.{format}&quot;</span>, <span style="color: #008000">// URL with parameters</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">       <span style="color: #0000ff">new</span> { controller = <span style="color: #006080">&quot;Home&quot;</span>, action = <span style="color: #006080">&quot;Index&quot;</span>, format = UrlParameter.Optional } <span style="color: #008000">// Parameter defaults</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">   );</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    routes.MapRoute(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">&quot;WithID&quot;</span>, <span style="color: #008000">// Route name</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">&quot;{controller}/{action}/{id}.{format}&quot;</span>, <span style="color: #008000">// URL with parameters</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">new</span> { controller = <span style="color: #006080">&quot;Home&quot;</span>, action = <span style="color: #006080">&quot;Index&quot;</span>, id = UrlParameter.Optional, format = UrlParameter.Optional } <span style="color: #008000">// Parameter defaults</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    );</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p><font color="#000000">Este es el controlador, aquí definimos los metodos que reciben los parámetros que hemos definido en el Global.asax</font></p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyClassController : Controller</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> All(<span style="color: #0000ff">string</span> format)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        List&lt;MyClassHelper.MyClass&gt; result = MyClassHelper.Data;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (format.ToLower() == <span style="color: #006080">&quot;xml&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> MyClassHelper.MyClassToXml(result);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> MyClassHelper.MyClassToJson(result);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Get(<span style="color: #0000ff">string</span> id, <span style="color: #0000ff">string</span> format)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        MyClassHelper.MyClass result = MyClassHelper.Data.Where(c =&gt; c.Id == id).FirstOrDefault();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (format.ToLower() == <span style="color: #006080">&quot;xml&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> MyClassHelper.MyClassToXml(result);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> MyClassHelper.MyClassToJson(result);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> GetByName(<span style="color: #0000ff">string</span> id, <span style="color: #0000ff">string</span> format)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        List&lt;MyClassHelper.MyClass&gt; result = MyClassHelper.Data.Where(c =&gt; c.Name == id).ToList();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (format.ToLower() == <span style="color: #006080">&quot;xml&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> MyClassHelper.MyClassToXml(result);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> MyClassHelper.MyClassToJson(result);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Put(<span style="color: #0000ff">string</span> format)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        MyClassHelper.MyClass c;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">using</span> (var reader = <span style="color: #0000ff">new</span> StreamReader(Request.InputStream))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (format.ToLower() == <span style="color: #006080">&quot;xml&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                c = MyClassHelper.XmlToMyClass(reader.ReadToEnd());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">               c = MyClassHelper.JsonToMyClass(reader.ReadToEnd());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        var v = from myc <span style="color: #0000ff">in</span> MyClassHelper.Data <span style="color: #0000ff">where</span> myc.Id == c.Id select myc;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (v.Count() == 0)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            MyClassHelper.Data.Add(c);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            v.First().Name = c.Name;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #006080">&quot;OK&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Delete(<span style="color: #0000ff">string</span> format)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        MyClassHelper.MyClass c;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">using</span> (var reader = <span style="color: #0000ff">new</span> StreamReader(Request.InputStream))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (format.ToLower() == <span style="color: #006080">&quot;xml&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                c = MyClassHelper.XmlToMyClass(reader.ReadToEnd());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                c = MyClassHelper.JsonToMyClass(reader.ReadToEnd());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        MyClassHelper.Data.Remove(c);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #006080">&quot;OK&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p><font color="#000000">Y listo, eso es todo <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2011/05/19/rest-services-json-y-xml-con-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 y .NET Framework 4</title>
		<link>http://www.thedotnetway.net/2009/10/30/visual-studio-2010-y-net-framework-4/</link>
		<comments>http://www.thedotnetway.net/2009/10/30/visual-studio-2010-y-net-framework-4/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 11:21:04 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/2009/10/30/visual-studio-2010-y-net-framework-4/</guid>
		<description><![CDATA[Cada vez queda menos para que tengamos disponible la nueva versión de VS, junto con .NET Framework 4.0, C# 4.0, ASP.NET 4.0 etc, así que lo mejor es irse preparando, por ese motivo la gente de Microsoft lanza los “Kits de Entrenamiento”. &#160;Aquí podéis encontrar el ultimo, de Octubre, en el encontraremos, presentaciones, demos y<a class="rmore" href="http://www.thedotnetway.net/2009/10/30/visual-studio-2010-y-net-framework-4/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thedotnetway.net/wp-content/uploads/2009/10/VS2010_UI.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="VS2010_UI" border="0" alt="VS2010_UI" align="left" src="http://www.thedotnetway.net/wp-content/uploads/2009/10/VS2010_UI_thumb.png" width="250" height="179" /></a> </p>
<p>Cada vez queda menos para que tengamos disponible la nueva versión de <a href="http://www.microsoft.com/spain/visualstudio/products/2010/default.mspx" target="_blank">VS</a>, junto con .NET Framework 4.0, C# 4.0, ASP.NET 4.0 etc, así que lo mejor es irse preparando, por ese motivo la gente de Microsoft lanza los “Kits de Entrenamiento”.</p>
<p>&#160;<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=752CB725-969B-4732-A383-ED5740F02E93&amp;displaylang=en" target="_blank">Aquí podéis encontrar el ultimo</a>, de Octubre, en el encontraremos, presentaciones, demos y ejemplos de:</p>
<p>C# 4.0, Visual Basic 10, F#, Parallel Extensions, Windows Communication Foundation, Windows Workflow,Windows Presentation Foundation, ASP.NET 4, Windows 7, Entity Framework,ADO.NET Data Services, Managed Extensibility Framework y Visual Studio Team System.</p>
<p>Así que no falta de nada <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2009/10/30/visual-studio-2010-y-net-framework-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Soap Extension</title>
		<link>http://www.thedotnetway.net/2009/10/07/soap-extension/</link>
		<comments>http://www.thedotnetway.net/2009/10/07/soap-extension/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 14:41:30 +0000</pubDate>
		<dc:creator>jordicb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[asmx]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[SOAP Extension]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/2009/10/07/soap-extension/</guid>
		<description><![CDATA[Soap Extension es un mecanismo de ASP.NET para interceptar mensages Soap cuando entran o salen de nuestro sistema. Existen cuatro puntos en todo el proceso del mensaje en los cuales podremos interceptar el mensaje: Para implementarla solo tenemos que crear una clase que herede de System.Web.Services.Protocols.SoapExtension. Aquí tienes un ejemplo sacado de la documentación de<a class="rmore" href="http://www.thedotnetway.net/2009/10/07/soap-extension/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>Soap Extension es un mecanismo de ASP.NET para interceptar mensages Soap cuando entran o salen de nuestro sistema. Existen cuatro puntos en todo el proceso del mensaje en los cuales podremos interceptar el mensaje:</p>
<p><a href="http://www.thedotnetway.net/wp-content/uploads/2009/10/esw638yk_xmlwebservicelifetimeenusVS_71.gif"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="esw638yk_xmlwebservicelifetime(en-us,VS_71)" border="0" alt="esw638yk_xmlwebservicelifetime(en-us,VS_71)" src="http://www.thedotnetway.net/wp-content/uploads/2009/10/esw638yk_xmlwebservicelifetimeenusVS_71_thumb.gif" width="475" height="245" /></a> </p>
<p>Para implementarla solo tenemos que crear una clase que herede de System.Web.Services.Protocols.SoapExtension. Aquí tienes un ejemplo sacado de la documentación de MSDN, intercepta los mensajes en la entrada duespues de serializar (Paso 2 en el gráfico) y en la salida antes de Deserializar (Paso 4 en el gráfico) y guarda los mensajes en disco.</p>
</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">TraceExtension </span>: <span style="color: #2b91af">SoapExtension
</span>{</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code">    Stream oldStream;
    Stream newStream;
    <span style="color: blue">string </span>filename;

    <span style="color: green">// Save the Stream representing the SOAP request or SOAP response into
    // a local memory buffer.
    </span><span style="color: blue">public override </span>Stream ChainStream( Stream stream ){
        oldStream = stream;
        newStream = <span style="color: blue">new </span>MemoryStream();
        <span style="color: blue">return </span>newStream;
    }

    <span style="color: green">// When the SOAP extension is accessed for the first time, the XML Web
    // service method it is applied to is accessed to store the file
    // name passed in, using the corresponding SoapExtensionAttribute.
    </span><span style="color: blue">public override object </span>GetInitializer(LogicalMethodInfo methodInfo,
	                                   SoapExtensionAttribute attribute)
    {
        <span style="color: blue">return </span>((TraceExtensionAttribute) attribute).Filename;
    }

    <span style="color: green">// The SOAP extension was configured to run using a configuration file
    // instead of an attribute applied to a specific XML Web service
    // method.
    </span><span style="color: blue">public override object </span>GetInitializer(Type WebServiceType)
    {
      <span style="color: green">// Return a file name to log the trace information to, based on the
      // type.
      </span><span style="color: blue">return </span><span style="color: #a31515">&quot;C:\\&quot; </span>+ WebServiceType.FullName + <span style="color: #a31515">&quot;.log&quot;</span>;
    }

    <span style="color: green">// Receive the file name stored by GetInitializer and store it in a
    // member variable for this specific instance.
    </span><span style="color: blue">public override void </span>Initialize(<span style="color: blue">object </span>initializer)
    {
        filename = (<span style="color: blue">string</span>) initializer;
    }

    <span style="color: green">//  If the SoapMessageStage is such that the SoapRequest or
    //  SoapResponse is still in the SOAP format to be sent or received,
    //  save it out to a file.
    </span><span style="color: blue">public override void </span>ProcessMessage(SoapMessage message)
    {
        <span style="color: blue">switch </span>(message.Stage) {
        <span style="color: blue">case </span>SoapMessageStage.BeforeSerialize:
            <span style="color: blue">break</span>;
        <span style="color: blue">case </span>SoapMessageStage.AfterSerialize:
            WriteOutput(message);
            <span style="color: blue">break</span>;
        <span style="color: blue">case </span>SoapMessageStage.BeforeDeserialize:
            WriteInput(message);
            <span style="color: blue">break</span>;
        <span style="color: blue">case </span>SoapMessageStage.AfterDeserialize:
            <span style="color: blue">break</span>;
        <span style="color: blue">default</span>:
             <span style="color: blue">throw new </span>Exception(<span style="color: #a31515">&quot;invalid stage&quot;</span>);
        }
    }

    <span style="color: blue">public void </span>WriteOutput(SoapMessage message){
        newStream.Position = 0;
        FileStream fs = <span style="color: blue">new </span>FileStream(filename, FileMode.Append,
                                       FileAccess.Write);
        StreamWriter w = <span style="color: blue">new </span>StreamWriter(fs);

        <span style="color: blue">string </span>soapString =
          (message <span style="color: blue">is </span>SoapServerMessage) ? <span style="color: #a31515">&quot;SoapResponse&quot; </span>: <span style="color: #a31515">&quot;SoapRequest&quot;</span>;
        w.WriteLine(<span style="color: #a31515">&quot;-----&quot; </span>+ soapString + <span style="color: #a31515">&quot; at &quot; </span>+ DateTime.Now);
        w.Flush();
        Copy(newStream, fs);
        w.Close();
        newStream.Position = 0;
        Copy(newStream, oldStream);
    }

    <span style="color: blue">public void </span>WriteInput(SoapMessage message){
        Copy(oldStream, newStream);
        FileStream fs = <span style="color: blue">new </span>FileStream(filename, FileMode.Append,
                                       FileAccess.Write);
        StreamWriter w = <span style="color: blue">new </span>StreamWriter(fs);

        <span style="color: blue">string </span>soapString = (message <span style="color: blue">is </span>SoapServerMessage) ?
                            <span style="color: #a31515">&quot;SoapRequest&quot; </span>: <span style="color: #a31515">&quot;SoapResponse&quot;</span>;
        w.WriteLine(<span style="color: #a31515">&quot;-----&quot; </span>+ soapString +
                    <span style="color: #a31515">&quot; at &quot; </span>+ DateTime.Now);
        w.Flush();
        newStream.Position = 0;
        Copy(newStream, fs);
        w.Close();
        newStream.Position = 0;
    }

    <span style="color: blue">void </span>Copy(Stream from, Stream to)
    {
        TextReader reader = <span style="color: blue">new </span>StreamReader(from);
        TextWriter writer = <span style="color: blue">new </span>StreamWriter(to);
        writer.WriteLine(reader.ReadToEnd());
        writer.Flush();
    }
  }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>&#160;</p>
<p>Para poder insertar la SoapExtension en la entrada y salida de un WebMethod hay que crear una clase que herede de SoapExtensionAttribute cuya propiedad ExtensionType le dice al framework que clase SoapExtension utilizar. También tiene una propiedad Priority para que en caso de que haya más de un SoapExtension el sistema sepa en que orden ejecutarlas:</p>
<pre class="code"><span style="color: green">  // Create a SoapExtensionAttribute for the SOAP Extension that can be
  // applied to an XML Web service method.
 </span>[AttributeUsage(AttributeTargets.Method)]
 <span style="color: blue">public class </span>TraceExtensionAttribute : SoapExtensionAttribute {

   <span style="color: blue">private string </span>filename = <span style="color: #a31515">&quot;c:\\log.txt&quot;</span>;
   <span style="color: blue">private int </span>priority;

   <span style="color: blue">public override </span>Type ExtensionType {
       <span style="color: blue">get </span>{ <span style="color: blue">return typeof</span>(TraceExtension); }
   }

   <span style="color: blue">public override int </span>Priority {
       <span style="color: blue">get </span>{ <span style="color: blue">return </span>priority; }
       <span style="color: blue">set </span>{ priority = value; }
   }

   <span style="color: blue">public string </span>Filename {
       <span style="color: blue">get </span>{
           <span style="color: blue">return </span>filename;
       }
       <span style="color: blue">set </span>{
           filename = value;
       }
   }</pre>
<p>Para que un WebMethod utilice la SoapExtension solo queda aplicar el SoapExtensionAttribute al método:</p>
<p>&#160;</p>
<pre class="code">[WebMethod]
[TraceExtension()]
<span style="color: blue">public string </span>MetodoWeb(<span style="color: blue">string </span>str)
{
    <span style="color: blue">return </span><span style="color: #a31515">&quot;Hola&quot;</span>;
}</pre>
<p>&#160;</p>
<p><a href="http://11011.net/software/vspaste">&#160;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2009/10/07/soap-extension/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Aplicaciones ASP.NET a Producci&#243;n</title>
		<link>http://www.thedotnetway.net/2009/05/07/aplicaciones-aspnet-a-produccin/</link>
		<comments>http://www.thedotnetway.net/2009/05/07/aplicaciones-aspnet-a-produccin/#comments</comments>
		<pubDate>Thu, 07 May 2009 09:04:14 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Trucos]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/2009/05/07/aplicaciones-aspnet-a-produccin/</guid>
		<description><![CDATA[Desde que hacer deploy de una aplicación ASP.NET no es mas que copiar en local y pegar en el servidor, la tarea de pasar las aplicaciones a producción la suele llevar a cabo el mismo programador, los programadores no estamos hecho para eso y muchas veces olvidamos detalles … Cuando pasamos una aplicación ASP.NET a<a class="rmore" href="http://www.thedotnetway.net/2009/05/07/aplicaciones-aspnet-a-produccin/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>Desde que hacer deploy de una aplicación <a href="http://www.asp.net" target="_blank">ASP.NET</a> no es mas que copiar en local y pegar en el servidor, la tarea de pasar las aplicaciones a producción la suele llevar a cabo el mismo programador, los programadores no estamos hecho para eso y muchas veces olvidamos detalles … <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cuando pasamos una aplicación <a href="http://www.asp.net" target="_blank">ASP.NET</a> a Producción, el fallo mas tonto y el mas habitual que cometemos es no modificar los valores del fichero <a href="http://es.wikipedia.org/wiki/Web.config" target="_blank">web.config</a> que hacen que la aplicación corra en modo depuración, eso hace que nuestra aplicación sea lenta como una tortuga <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Hay un truco para tener el servidor de producción configurado de manera que cualquier aplicación ASP.NET que se instale no corra en modo depuración, esto se consigue modificando el machine.config del servidor (<em>C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG</em>) de la siguiente manera:</p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6b6a17de-e202-481b-8d21-999b12fc06ff" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;overflow: auto;;font-family:Microsoft Sans Serif;font-size:9,75"><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">configuration</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
    </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">system.web</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
          </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">deployment </span><span style="color: #FF0000;">retail</span><span style="color: #0000FF;">=”true”/&gt;
    </span><span style="color: #FF0000;">&lt;/system.web</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">configuration</span><span style="color: #0000FF;">&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Con esta configuración el servidor, al ejecutar las aplicaciones ASP.NET, no tendrá en cuenta los valores debug, trace y enableCustomErrors del archivo de configuración de la aplicación y se ejecutara siempre con estos valores:</p>
<p>· debug=false<br />
  <br />· trace=false </p>
<p>· enableCustomErrors=RemoteOnly</p>
<p>Como debe ser en producción <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2009/05/07/aplicaciones-aspnet-a-produccin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web.config y configSource</title>
		<link>http://www.thedotnetway.net/2008/11/21/webconfig-y-confisource/</link>
		<comments>http://www.thedotnetway.net/2008/11/21/webconfig-y-confisource/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 08:40:00 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://thedotnetway.wordpress.com/2008/11/21/webconfig-y-confisource/</guid>
		<description><![CDATA[configSource es un atributo que nos permite indicar otro fichero .config para una sección. Por ejemplo, que queremos tener nuestra configuración especifica en un fichero aparte para que sea menos lioso &#60;appSettings configSource =&#34;mySettings.config&#34; /&#62; Que queremos tener las cadenas de conexión de SQL en otro sitio &#60;connectionStrings configSource=&#34;MyConns.config&#34; /&#62; Esto nos permite tener un<a class="rmore" href="http://www.thedotnetway.net/2008/11/21/webconfig-y-confisource/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>configSource es un atributo que nos permite indicar otro fichero .config para una sección.</p>
<p>Por ejemplo, que queremos tener nuestra configuración especifica en un fichero aparte para que sea menos lioso</p>
<div style="margin:0 0 10pt;"><span style="font-size:10pt;color:blue;line-height:115%;">&lt;</span><span style="font-size:10pt;color:#a31515;line-height:115%;">appSettings </span><span style="font-size:10pt;color:red;line-height:115%;">configSource</span><span style="font-size:10pt;color:blue;line-height:115%;"> =</span><span style="font-size:10pt;line-height:115%;">&quot;<span style="color:blue;">mySettings.config</span>&quot; /<span style="color:blue;">&gt;</span></span></div>
<p><font face="Arial">Que queremos tener las cadenas de conexión de SQL en otro sitio</font></p>
<div style="margin:0 0 10pt;"><span style="font-size:10pt;color:blue;line-height:115%;">&lt;</span><span style="font-size:10pt;color:#a31515;line-height:115%;">connectionStrings </span><span style="font-size:10pt;color:red;line-height:115%;">configSource</span><span style="font-size:10pt;color:blue;line-height:115%;">=</span><span style="font-size:10pt;line-height:115%;">&quot;<span style="color:blue;">MyConns.config</span>&quot; /<span style="color:blue;">&gt;</span></span></div>
<p>Esto nos permite tener un web.config menos lioso, dejar que gente de menos nivel configure las aplicaciones sin tocar el web.config e incluso pasar a producción sin tener que acordarte de todos los cambios que tienes que hacer en el web.config.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2008/11/21/webconfig-y-confisource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft incluirá JQuery en la nueva versión de Visual Studio</title>
		<link>http://www.thedotnetway.net/2008/09/29/microsoft-incluiraacute-jquery-en-la-nueva-versioacuten-de-visual-studio/</link>
		<comments>http://www.thedotnetway.net/2008/09/29/microsoft-incluiraacute-jquery-en-la-nueva-versioacuten-de-visual-studio/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 11:35:00 +0000</pubDate>
		<dc:creator>jordicb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://thedotnetway.wordpress.com/2008/09/29/microsoft-incluiraacute-jquery-en-la-nueva-versioacuten-de-visual-studio/</guid>
		<description><![CDATA[JQuery la librería de desarrollo web Javascript será incluida &#34;de fábrica&#34; en la siguiente versión de Visual Studio, aunque de momento ya lo hará con ASP.NET MVC. Además Microsoft contribuirá con tests, arreglos de bugs y parches. Para los que no lo conozcan JQuery permite seleccionar y manipular elementos HTML con poquísimas líneas de código.<a class="rmore" href="http://www.thedotnetway.net/2008/09/29/microsoft-incluiraacute-jquery-en-la-nueva-versioacuten-de-visual-studio/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://jquery.com/" target="_blank">JQuery</a> la librería de desarrollo web Javascript será incluida &quot;de fábrica&quot; en la siguiente versión de Visual Studio, aunque de momento ya lo hará con <a href="http://www.asp.net/mvc/" target="_blank">ASP.NET MVC</a>. Además Microsoft contribuirá con tests, arreglos de bugs y parches.</p>
<p><a href="http://jquery.com/" target="_blank"><img style="border-width:0;" height="57" alt="image" src="http://www.thedotnetway.net/content/binary/WindowsLiveWriter/MicrosoftincluirJQueryenlanuevaversindeV_EF2F/image_3.png" width="219" border="0" /></a></p>
<p>Para los que no lo conozcan JQuery permite seleccionar y manipular elementos HTML con poquísimas líneas de código. </p>
<p><a href="http://www.hanselman.com/blog/jQueryToShipWithASPNETMVCAndVisualStudio.aspx" target="_blank">Aquí</a> tenéis unos ejemplos de como JQuery se integra perfectamente con ASP.NET AJAX.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2008/09/29/microsoft-incluiraacute-jquery-en-la-nueva-versioacuten-de-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VS 2008 Web Development Hot-Fix</title>
		<link>http://www.thedotnetway.net/2008/02/11/vs-2008-web-development-hot-fix/</link>
		<comments>http://www.thedotnetway.net/2008/02/11/vs-2008-web-development-hot-fix/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 14:21:00 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://thedotnetway.wordpress.com/2008/02/11/vs-2008-web-development-hot-fix/</guid>
		<description><![CDATA[Microsoft ha publicado un nuevo hot-fix para vs 2008 que arregla varios bugs en proyectos Web. La lista de problemas que arregla la tenéis aquí. VS 2008 Web Development Hot-Fix]]></description>
			<content:encoded><![CDATA[<p>Microsoft ha publicado un nuevo hot-fix para vs 2008 que arregla varios bugs en proyectos Web. La lista de problemas que arregla la tenéis <a href="http://weblogs.asp.net/scottgu/archive/2008/02/08/vs-2008-web-development-hot-fix-roll-up-available.aspx" target="_blank">aquí</a>.</p>
<p> <a href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=10826" target="_blank">VS 2008 Web Development Hot-Fix</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2008/02/11/vs-2008-web-development-hot-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft ASP.NET 3.5 Extensions Preview</title>
		<link>http://www.thedotnetway.net/2007/12/12/microsoft-aspnet-35-extensions-preview/</link>
		<comments>http://www.thedotnetway.net/2007/12/12/microsoft-aspnet-35-extensions-preview/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 13:12:00 +0000</pubDate>
		<dc:creator>jordicb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://thedotnetway.wordpress.com/2007/12/12/microsoft-aspnet-35-extensions-preview/</guid>
		<description><![CDATA[Han publicado en ASP.NET las Microsoft ASP.NET 3.5 Extensions Preview En la versión cabe destacar la inclusión del MVC, El Entity Framework, los Data Services y algunos controles para SilverLight]]></description>
			<content:encoded><![CDATA[</p>
<p>Han publicado en ASP.NET las <a href="http://asp.net/downloads/3.5-extensions/">Microsoft ASP.NET 3.5 Extensions Preview</a></p>
<p><a href="http://www.asp.net/"><img src="http://www.thedotnetway.net/content/binary/logoASP.png" border="0" /></a></p>
<p>En la versión cabe destacar la inclusión del MVC, El Entity Framework, los Data Services y algunos controles para SilverLight</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2007/12/12/microsoft-aspnet-35-extensions-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ejecutar los métodos de nuestro WebForm ASP.NET desde la parte Cliente con Java Script</title>
		<link>http://www.thedotnetway.net/2007/11/12/ejecutar-los-metodos-de-nuestro-webform-aspnet-desde-la-parte/</link>
		<comments>http://www.thedotnetway.net/2007/11/12/ejecutar-los-metodos-de-nuestro-webform-aspnet-desde-la-parte/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 13:57:00 +0000</pubDate>
		<dc:creator>jordicb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://thedotnetway.wordpress.com/2007/11/12/ejecutar-los-metodos-de-nuestro-webform-aspnet-desde-la-parte/</guid>
		<description><![CDATA[Podemos ejecutar los métodos que tenemos definidos en el código de nuestro webform desde la parte cliente, los pasos a seguir son: 1- Añadir un Script Manager e indicarle que los PageMethods están activos: &#60;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"/&#62; 3- Creamos las funciones en Javascript, la estructura sera PageMethods.NombreDelMetodo y recibe como parametros los del metodo<a class="rmore" href="http://www.thedotnetway.net/2007/11/12/ejecutar-los-metodos-de-nuestro-webform-aspnet-desde-la-parte/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>Podemos ejecutar los métodos que tenemos definidos en el código de nuestro webform desde la parte cliente, los pasos a seguir son:</p>
<p>1- Añadir un Script Manager e indicarle que los PageMethods están activos:</p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:54e78e0b-05d4-4d51-a298-a106d0d89e16" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#FFFFFF;white-space:pre-wrap;overflow:auto;font-family:Microsoft Sans Serif;font-size:11px;"><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">asp:ScriptManager </span><span style="color:#FF0000;">ID</span><span style="color:#0000FF;">="ScriptManager1"</span><span style="color:#FF0000;">
 runat</span><span style="color:#0000FF;">="server"</span><span style="color:#FF0000;">  EnablePageMethods</span><span style="color:#0000FF;">="true"</span><span style="color:#0000FF;">/&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>2-El Método que queremos ejecutar tiene que ser estático y estar marcado con el atributo [WebMethod]</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:25ca4c13-ea4c-4f50-a8e4-fa3a1b7bc892" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#FFFFFF;white-space:pre-wrap;overflow:auto;font-family:Microsoft Sans Serif;font-size:11px;"><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">partial</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> _Default : System.Web.UI.Page
{
    </span><span style="color:#0000FF;">protected</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> Page_Load(</span><span style="color:#0000FF;">object</span><span style="color:#000000;"> sender, EventArgs e)
    {
    }

    [WebMethod]
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> GetHello(</span><span style="color:#0000FF;">string</span><span style="color:#000000;"> Name)
    {
        </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Hello </span><span style="color:#800000;">"</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> Name;
    }
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>3- Creamos las funciones en Javascript, la estructura sera PageMethods.NombreDelMetodo y recibe como parametros los del metodo mas los manejadores</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:ffd5587c-ffd6-4503-883f-4b8a5e3a0fdc" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#FFFFFF;white-space:pre-wrap;overflow:auto;"><span style="color:#000000;">&lt;</span><span style="color:#000000;">script  type</span><span style="color:#000000;">=</span><span style="color:#000000;">"</span><span style="color:#000000;">text/javascript</span><span style="color:#000000;">"</span><span style="color:#000000;"> language</span><span style="color:#000000;">=</span><span style="color:#000000;">"</span><span style="color:#000000;">javascript</span><span style="color:#000000;">"</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">
 </span><span style="color:#0000FF;">function</span><span style="color:#000000;"> ClientGetHello(){
   PageMethods.GetHello($get(</span><span style="color:#000000;">"</span><span style="color:#000000;">TextBox1</span><span style="color:#000000;">"</span><span style="color:#000000;">).value,
    onCallbackComplete,
    onCallbackError,
    onCallbackError);
}

 </span><span style="color:#0000FF;">function</span><span style="color:#000000;"> onCallbackComplete(result){
     alert(result);
}

 </span><span style="color:#0000FF;">function</span><span style="color:#000000;"> onCallbackError(){
     alert(</span><span style="color:#000000;">'</span><span style="color:#000000;">Se ha producido un Error</span><span style="color:#000000;">'</span><span style="color:#000000;">);
}
</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">/</span><span style="color:#000000;">script&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>4-Ya podemos usar ese método desde la parte cliente</p>
</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:d54799d3-474b-4bfe-b331-d32e5114f525" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#FFFFFF;white-space:pre-wrap;overflow:auto;"><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">div </span><span style="color:#FF0000;">id</span><span style="color:#0000FF;">="MyDiv"</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
     </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">input </span><span style="color:#FF0000;">id</span><span style="color:#0000FF;">="Button1"</span><span style="color:#FF0000;"> type</span><span style="color:#0000FF;">="button"</span><span style="color:#FF0000;"> value</span><span style="color:#0000FF;">="button"</span><span style="color:#FF0000;">
  onclick</span><span style="color:#0000FF;">="JavaScript:ClientGetHello();"</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
     </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">asp:TextBox </span><span style="color:#FF0000;">ID</span><span style="color:#0000FF;">="TextBox1"</span><span style="color:#FF0000;"> runat</span><span style="color:#0000FF;">="server"</span><span style="color:#0000FF;">&gt;&lt;/</span><span style="color:#800000;">asp:TextBox</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
 </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">div</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2007/11/12/ejecutar-los-metodos-de-nuestro-webform-aspnet-desde-la-parte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET Servicios Web y CacheDuration (de paso como activar POST y GET en nuestros servicios web)</title>
		<link>http://www.thedotnetway.net/2007/11/08/aspnet-servicios-web-y-cacheduration-de-paso-como-activar-post/</link>
		<comments>http://www.thedotnetway.net/2007/11/08/aspnet-servicios-web-y-cacheduration-de-paso-como-activar-post/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 08:32:00 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[WebServices]]></category>

		<guid isPermaLink="false">http://thedotnetway.wordpress.com/2007/11/08/aspnet-servicios-web-y-cacheduration-de-paso-como-activar-post/</guid>
		<description><![CDATA[CacheDuration es un atributo de WebMethod con el que podemos implementar de manera muy sencilla un sistema de chache basado en el tiempo, cuando le indicamos la duración del Cache (en segundos) el servidor guarda los parámetros del request y la respuesta, así mientras no caduque el cache para parámetros iguales el código de nuestro<a class="rmore" href="http://www.thedotnetway.net/2007/11/08/aspnet-servicios-web-y-cacheduration-de-paso-como-activar-post/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>CacheDuration es un atributo de WebMethod con el que podemos implementar de manera muy sencilla un sistema de chache basado en el tiempo, cuando le indicamos la duración del Cache (en segundos) el servidor guarda los parámetros del request y la respuesta, así mientras no caduque el cache para parámetros iguales el código de nuestro método no se ejecutara y devolverá el resultado desde el cache.</p>
<p>Podéis probar con este código, la primera vez tardara 5 segundos, pero durante el siguiente minuto, para el mismo Texto, será instantáneo:</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:9a793836-d3a6-4e1d-a82d-5311676a3849" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#FFFFFF;white-space:pre-wrap;overflow:auto;font-family:Microsoft Sans Serif;font-size:11px;"><span style="color:#000000;">WebMethod(CacheDuration</span><span style="color:#000000;">=</span><span style="color:#800080;">60</span><span style="color:#000000;">)]
 </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> CountChars(</span><span style="color:#0000FF;">string</span><span style="color:#000000;"> Text)
 {
     System.Threading.Thread.Sleep(</span><span style="color:#800080;">5000</span><span style="color:#000000;">);
     </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> String.IsNullOrEmpty(Text) </span><span style="color:#000000;">?</span><span style="color:#000000;"> </span><span style="color:#800080;">0</span><span style="color:#000000;"> : Text.Length;
 }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>Ojo que las peticiones vía POST no se guardan en el cache y la pagina de pruebas de los servicios web funciona con POST, así que debes probarlo o bien por SOAP o bien por GET.</p>
<p>Por defecto los servicios web llevan el GET y el POST desactivado, para activarlos solo tenéis que añadir esto dentro de &lt;system.web&gt; en el Web.config:<br />
  </p>
</p>
<p><font color="#000000"></font></p>
<div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:aa7ea533-7fb5-409a-8e19-e17089f5db76" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#FFFFFF;white-space:pre-wrap;overflow:auto;font-family:Microsoft Sans Serif;font-size:11px;"><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">webServices</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
   </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">protocols</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
      </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">add </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">="HttpGet"</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
      </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">add </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">="HttpPost"</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
   </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">protocols</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">webServices</span><span style="color:#0000FF;">&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2007/11/08/aspnet-servicios-web-y-cacheduration-de-paso-como-activar-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

