I have http://example.com/Image/Show/CwYDBw8LDww where example.com is my site, Show is a method in the Image controller, the unique id CwYDBw8LDww is a key in a database which will point to some other URL on a different domain, e.g. a "hosted" image on Google.
The reason for doing this is that the URLs can get horribly long and unwieldy. I am storing the site content as Markdown/HTML and want to be able to write things like:
<p>Here is an image of a cat.</p>
<img src="http://example.com/Image/Show/CwYDBw8LDww">
and have it render the page as if I put:
<img src="http://googleusercontent.com/SomeReallyReallyReallyLongImageURL.jpg">
So in the database there is a table entry with values:("CwYDBw8LDww", "http://googleusercontent.com/SomeReallyLongImageURL.jpg") which is how I know which "really long URL" belongs to the short code.
I know how to (e.g.) print the 'google' URL to the screen by getting an Action to return it, I am already able to talk to the database, etc. The part I'm missing is getting /Images/Show?shortcode=CwYDBw8LDww
to bring back the Google image in a way that it can be rendered on the page. And whether I should be doing that in the View, or what.
My View currently has something like:
@Html.Raw(@Model.ArticleContent)
where the content is already stored as <p>Here is an image of a cat</p>
etc.