<?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>Petra Link Factory &#187; asp</title>
	<atom:link href="http://www.petralinkfactory.com/tag/asp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.petralinkfactory.com</link>
	<description>Programar no es un hobby es una pasión</description>
	<lastBuildDate>Sun, 15 Jan 2012 09:14:58 +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>URL Amigables (y III) (ASP)</title>
		<link>http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/</link>
		<comments>http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 10:05:33 +0000</pubDate>
		<dc:creator>Valde</dc:creator>
				<category><![CDATA[programación]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[url limpias]]></category>

		<guid isPermaLink="false">http://www.petralinkfactory.com/?p=8</guid>
		<description><![CDATA[Bueno, lo del retraso va a ser lo usual en mi por lo que parece, pero entre que he estado muy liado con un proyecto grande y que en medio he estado de vacaciones he tardado un poco en escribir &#8230; <a href="http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Bueno, lo del retraso va a ser lo usual en mi por lo que parece, pero entre que he estado muy liado con un proyecto grande y que en medio he estado de vacaciones he tardado un poco en escribir esta entrada.</p>
<p>En esta entrada, que en principio serÃ¡ la Ãºltima de las URL Amigables, vamos a ver cÃ³mo implementarlas en ASP 3.0 sobre IIS, como mi hosting es PHP no puedo poner ningÃºn ejemplo on-line, pero si pondrÃ© un ejemplo comprimido en formato zip para que lo podÃ¡is probar en vuestro IIS.</p>
<p>Al igual que en php lo que vamos a utilizar para simuar el mÃ³dulo ReWrite de Apache es usar la pÃ¡gina de error 404. Para ello lo que hay que hacer es crear el sitio web en el IIS. Luego editamos el sitio web, para ello pulsamos con el botÃ³n derecho sobre el sitio web y accedemos a las propiedades del sitio web. Una vez que estamos en las propiedades del sitio web, pincha sobre la carpeta de errores personalizados. AllÃ­ deberÃ¡s de cambiar todos los errores que se generan con el error 404, generalmente hay 3 (al menos en el IIS6 de Windows 2003, que es yo utilizo). La url que debes poner es /controllers/controller.asp (para mi ejemplo, en otro caso deberÃ¡s poner el fichero que desees). Como puedes ver es lo mismo que hice en PHP.</p>
<p>Ahora ya solo nos queda procesar la URL y dirigirnos al mÃ³dulo necesario.</p>
<div class="igBar"><span id="lasp-2"><a href="#" onclick="javascript:showPlainTxt('asp-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">ASP:</span>
<div id="asp-2">
<div class="asp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">'&nbsp; Vamos a averiguar el controlador que se nos ha pedido.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">strController = <span style="color:#990099; font-weight:bold;">replace</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#990099; font-weight:bold;">Request</span>.<span style="color:#330066;">QueryString</span>, <span style="color:#CC0000;">"404;http://localhost/urlamigables:80/"</span>, <span style="color:#CC0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">aControl = <span style="color:#990099; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span>strController, <span style="color:#CC0000;">"/"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Control = <span style="color:#CC0000;">""</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Param = <span style="color:#CC0000;">""</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">If</span> <span style="color:#990099; font-weight:bold;">IsArray</span><span style="color:#006600; font-weight:bold;">&#40;</span>aControl<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF; font-weight:bold;">And</span> <span style="color:#990099; font-weight:bold;">UBound</span><span style="color:#006600; font-weight:bold;">&#40;</span>aControl<span style="color:#006600; font-weight:bold;">&#41;</span>&amp;gt; <span style="color:#800000;color:#800000;">0</span> <span style="color:#990099; font-weight:bold;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Control = aControl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Session</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"ParamController"</span><span style="color:#006600; font-weight:bold;">&#41;</span> = <span style="color:#990099; font-weight:bold;">Replace</span><span style="color:#006600; font-weight:bold;">&#40;</span>strController, aControl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;amp; <span style="color:#CC0000;">"/"</span>, <span style="color:#CC0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">'&nbsp; No es array, con lo que no hay ninguna barra y el strController es el control.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Control = strController</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Session</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"ParamController"</span><span style="color:#006600; font-weight:bold;">&#41;</span> = <span style="color:#CC0000;">""</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">End</span> <span style="color:#990099; font-weight:bold;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Select</span> <span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#990099; font-weight:bold;">LCase</span><span style="color:#006600; font-weight:bold;">&#40;</span>Control<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#CC0000;">"modulo1"</span> :</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Server</span>.<span style="color:#330066;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"modulo1.asp"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#CC0000;">"modulo2"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Server</span>.<span style="color:#330066;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"modulo2.asp"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#990099; font-weight:bold;">Else</span> :</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Server</span>.<span style="color:#330066;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"404.asp"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">End</span> <span style="color:#990099; font-weight:bold;">Select</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">%&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
puedes ver es lo mismo que hice en PHP</p>
<p>Bueno bÃ¡sicamente ya solo quedan los ficheros de los mÃ³dulos y el fichero de acciones, que no tienen mucho que ver, los podÃ©is ver en el zip con todos los ficheros necesarios.</p>
<p><a title="Descarga el ejemplo" href="http://www.petralinkfactory.com/docs/urlamigable-asp.zip">Fichero Zip</a> con un ejemplo de las url amigales.</p>
<p>Pues ya estÃ¡ acabada esta serie de 3 artÃ­culos sobre las URLs Amigables. Espero que mi prÃ³ximo artÃ­culo no se espacie mucho en el tiempo, pero es que estoy muy liado, hay veces que estoy muy ocioso, y otras veces me salen 3 trabajos a la vez, y no los puedo rechazar.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

