<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: ASP.Net MVC &#8211; How to route to images or other file types</title>
	<atom:link href="http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/</link>
	<description>ASP.Net and PHP go head to head</description>
	<lastBuildDate>Tue, 24 Jan 2012 07:03:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: embarus</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-64209</link>
		<dc:creator>embarus</dc:creator>
		<pubDate>Sun, 18 Dec 2011 17:09:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-64209</guid>
		<description>Hello morgan.

Thank you for your useful post. 
I&#039;ve tried to implement custom route myself.
However, it does not work. 

My custom route is OggHandler and it is not called.

I have posted the question at stackoverflow

http://stackoverflow.com/questions/8550911/custom-route-is-not-called-for-asp-net-mvc-3-application-net-4

and can download link at

http://codesanook.com/shared/MvcOgg.zip</description>
		<content:encoded><![CDATA[<p>Hello morgan.</p>
<p>Thank you for your useful post.<br />
I&#039;ve tried to implement custom route myself.<br />
However, it does not work. </p>
<p>My custom route is OggHandler and it is not called.</p>
<p>I have posted the question at stackoverflow</p>
<p><a href="http://stackoverflow.com/questions/8550911/custom-route-is-not-called-for-asp-net-mvc-3-application-net-4" rel="nofollow">http://stackoverflow.com/questions/8550911/custom-route-is-not-called-for-asp-net-mvc-3-application-net-4</a></p>
<p>and can download link at</p>
<p><a href="http://codesanook.com/shared/MvcOgg.zip" rel="nofollow">http://codesanook.com/shared/MvcOgg.zip</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Virtual paths to actual physical files using Routing in Asp.Net and IIS &#124; SeekPHP.com</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-59525</link>
		<dc:creator>Virtual paths to actual physical files using Routing in Asp.Net and IIS &#124; SeekPHP.com</dc:creator>
		<pubDate>Tue, 18 Oct 2011 12:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-59525</guid>
		<description>[...] I use Routing to re-route URL&#8217;s to actual physical files. My code is pretty identical to this one. [...]</description>
		<content:encoded><![CDATA[<div style="padding: 1em; background-color: #FFCD71;">
<p>[...] I use Routing to re-route URL&#039;s to actual physical files. My code is pretty identical to this one. [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pawan Bhise</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-56168</link>
		<dc:creator>Pawan Bhise</dc:creator>
		<pubDate>Thu, 04 Aug 2011 04:52:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-56168</guid>
		<description>Hi! 
Should i add a new class to implement IRouteHandler or in global.asax(in MVC).IF yes where will it be in Model folder or outside.plz suugest m confused.</description>
		<content:encoded><![CDATA[<p>Hi!<br />
Should i add a new class to implement IRouteHandler or in global.asax(in MVC).IF yes where will it be in Model folder or outside.plz suugest m confused.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-50818</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Sun, 09 Jan 2011 18:17:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-50818</guid>
		<description>Great post, simple yet powerful. thanks.</description>
		<content:encoded><![CDATA[<p>Great post, simple yet powerful. thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin1441</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-40210</link>
		<dc:creator>Erwin1441</dc:creator>
		<pubDate>Fri, 23 Jul 2010 11:27:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-40210</guid>
		<description>I managed to solve this problem by writing an ImageHelper class and access my images like this:

&lt;img src=&quot;&quot; alt=&quot;&quot;&gt;

My class looks like this:

    public static class ImageHelper
    {
        public static string ImgUrl(string applicationPath, string filename)
        {
            if (applicationPath == &quot;/&quot;)
            {
                return &quot;/Images/&quot; + filename;
            }
            else
            {
                return applicationPath + &quot;/Images/&quot; + filename;
            }
        }
    }</description>
		<content:encoded><![CDATA[<p>I managed to solve this problem by writing an ImageHelper class and access my images like this:</p>
<p>&lt;img src=&quot;&#034; alt=&#034;"&gt;</p>
<p>My class looks like this:</p>
<p>    public static class ImageHelper<br />
    {<br />
        public static string ImgUrl(string applicationPath, string filename)<br />
        {<br />
            if (applicationPath == &#034;/&#034;)<br />
            {<br />
                return &#034;/Images/&#034; + filename;<br />
            }<br />
            else<br />
            {<br />
                return applicationPath + &#034;/Images/&#034; + filename;<br />
            }<br />
        }<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin1441</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-39870</link>
		<dc:creator>Erwin1441</dc:creator>
		<pubDate>Thu, 15 Jul 2010 16:04:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-39870</guid>
		<description>Hi morgan,

Thanks for this great guide! It&#039;s been most helpful. I&#039;ve got everything to work fine in my local test environment where my application runs in the root of the development webserver.

I&#039;m having a problem however when uploading my application to my production server, where the application resides within a subdir of the root. How am I supposed to acces my images in this way?

Kind regards,
Erwin</description>
		<content:encoded><![CDATA[<p>Hi morgan,</p>
<p>Thanks for this great guide! It&#039;s been most helpful. I&#039;ve got everything to work fine in my local test environment where my application runs in the root of the development webserver.</p>
<p>I&#039;m having a problem however when uploading my application to my production server, where the application resides within a subdir of the root. How am I supposed to acces my images in this way?</p>
<p>Kind regards,<br />
Erwin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-38231</link>
		<dc:creator>Dinesh</dc:creator>
		<pubDate>Thu, 10 Jun 2010 19:06:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-38231</guid>
		<description>I dont think the implementation in GetHttpHandler should be writing to the Response. It is a Get method and should not have a state change. Ideally a seperate class which implements IHttpHandler interface should take care of writing to the Reponse. and the main Route Handler should just create an instance of it and return in GetHttpHandler. I implemented something similar when i had to serve static content (css,js,images)</description>
		<content:encoded><![CDATA[<div style="padding: 1em; background-color: #FFCD71;">
<p>I dont think the implementation in GetHttpHandler should be writing to the Response. It is a Get method and should not have a state change. Ideally a seperate class which implements IHttpHandler interface should take care of writing to the Reponse. and the main Route Handler should just create an instance of it and return in GetHttpHandler. I implemented something similar when i had to serve static content (css,js,images)</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: chad</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-37603</link>
		<dc:creator>chad</dc:creator>
		<pubDate>Tue, 25 May 2010 22:22:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-37603</guid>
		<description>Morgan i think you meant &quot;graphics/{*filepath}&quot; . right?</description>
		<content:encoded><![CDATA[<p>Morgan i think you meant &#034;graphics/{*filepath}&#034; . right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: morgan</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-23226</link>
		<dc:creator>morgan</dc:creator>
		<pubDate>Wed, 23 Sep 2009 06:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-23226</guid>
		<description>Hey Brian,

Absolutely - you can use the catch-all parameter in ASP.Net MVC for this.  Define your route like:

&quot;graphics/{filepath*}&quot; 

and it will capture the rest of the URL string without splitting it.

(Apologies for the late reply... I didn&#039;t seem to get a notification about this comment...)</description>
		<content:encoded><![CDATA[<div style="padding: 1em; background-color: #FFCD71;">
<p>Hey Brian,</p>
<p>Absolutely &#8211; you can use the catch-all parameter in ASP.Net MVC for this.  Define your route like:</p>
<p>&#034;graphics/{filepath*}&#034; </p>
<p>and it will capture the rest of the URL string without splitting it.</p>
<p>(Apologies for the late reply&#8230; I didn&#039;t seem to get a notification about this comment&#8230;)</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/comment-page-1/#comment-20845</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 01 Sep 2009 19:29:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpvs.net/?p=123#comment-20845</guid>
		<description>Pretty cool, thanks for posting.

I wonder what you would do if you had a folder in your /graphics directory, like:
    /graphics/icons/add.gif

I believe it will not match the route (because it will split {filename} once it encounters the &quot;/&quot; between &quot;icons&quot; and &quot;add&quot;.

Is there a way to get the URL to ignore the slashes, so that it is essentially
   &quot;graphics/{filepath}&quot;?</description>
		<content:encoded><![CDATA[<p>Pretty cool, thanks for posting.</p>
<p>I wonder what you would do if you had a folder in your /graphics directory, like:<br />
    /graphics/icons/add.gif</p>
<p>I believe it will not match the route (because it will split {filename} once it encounters the &#034;/&#034; between &#034;icons&#034; and &#034;add&#034;.</p>
<p>Is there a way to get the URL to ignore the slashes, so that it is essentially<br />
   &#034;graphics/{filepath}&#034;?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

