Reputation: 43
Just having a problem trying to properly display an image from an external site but mvc constraints links and automatically adds the localhost: url at the start of everything even with custom routing this cannot be avoided
eg I require: www.google.com/finance/chart?q=NYSE:V&tlf=12
but i am getting: http://localhost:3022/www.google.com/finance/chart?q=NYSE:V&tlf=12
any help would be much appreciated
Upvotes: 4
Views: 3226
Reputation: 19465
If you require a link on a separate domain, you need to add http://
So :
Should work!
Why? Without the http
, the link is considered relative and the browser uses the relative domain -> localhost
!
Upvotes: 0
Reputation: 40150
Your problem is not MVC; it is the formation of your <a>
tags. You are doing it like this:
<a href="www.google.com/finance/chart?q=NYSE:V&tlf=12">blah...</a>
You should be doing it like this:
<a href="http://www.google.com/finance/chart?q=NYSE:V&tlf=12">blah...</a>
Without including the protocol at the beginning, the browser assumes your link is relative to the current site. It has nothing whatsoever to do with MVC.
Upvotes: 8