删除本地主机地址在ASP MVC [英] Removing Localhost url in asp mvc

查看:101
本文介绍了删除本地主机地址在ASP MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要有试图正确显示来自外部网站,但MVC约束链接的图像问题,并自动将本地主机:即使自定义路由这个是无法避免的网址是一切的开始。

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

如我要求:www.google.com/finance/chart?q=NYSE:V&tlf=12

eg I require: www.google.com/finance/chart?q=NYSE:V&tlf=12

但我得到:的http:/ /localhost:3022/www.google.com/finance/chart?q=NYSE:V&tlf=12

任何帮助将非常AP preciated

any help would be much appreciated

推荐答案

您的问题不是MVC;它是你的&LT的形成; A> 标记。你正在做这样的:

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>

您应该做这样的:

<a href="http://www.google.com/finance/chart?q=NYSE:V&tlf=12">blah...</a>

不包括开头的协议,与的浏览器的假定你的链接是相对于当前站点。它的两手空空的做MVC。

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.

这篇关于删除本地主机地址在ASP MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆