在行动中输入/site.com:像http://site.com输入网址变更为http [英] Input Url like http://site.com changes to http:/site.com in action input

查看:162
本文介绍了在行动中输入/site.com:像http://site.com输入网址变更为http的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问一个问题在这里得到 URL作为行动的输入。现在我有一个新的问题。所传递的URL行动改变从 http://google.com HTTP:/google.com

我想知道为什么,我怎么能解决这个问题。

P.S:我添加了这个$​​ C $ C来解决,但我觉得有可能是未来的另一个问题!在code是:

  IF((url.Contains(:/!))及及(url.Contains(://)))
{
    网址= url.Replace(:/,://);
}


浏览器(或服务器)与单一替换双斜杠(非法的)。结果
试试吧,

<$c$c>http://stackoverflow.com/questions/11853025//input-url-like-http-site-com-changes-to-http-site-com-in-action-input

(在Chrome)变为:

<$c$c>http://stackoverflow.com/questions/11853025/input-url-like-http-site-com-changes-to-http-site-com-in-action-input

如果我是你,我会删除HTTP:从您的路径//后来添加

的http://本地主机:1619 /工具/ PR / google.com /

然后, URL =HTTP://+ URL;

如果你可能会得到安全网址添加到路由 /http/google.com /https/google.com

I asked a question to get url as action input here. Now I have a new problem. The passed url to action changes from http://google.com to http:/google.com.

I want to know why and how can I resolve the problem.

P.S: I added this code to resolve but I think there may be another problems in future! the code is:

if ((url.Contains(":/")) && !(url.Contains("://")))
{
    url = url.Replace(":/", "://");
}

解决方案

The browser (or server) is replacing a double slash (illegal) with a single one.
Try it,

http://stackoverflow.com/questions/11853025//input-url-like-http-site-com-changes-to-http-site-com-in-action-input

(in Chrome) goes to:

http://stackoverflow.com/questions/11853025/input-url-like-http-site-com-changes-to-http-site-com-in-action-input

If I were you, I would remove the http:// from your path and add it later.

http://localhost:1619/Utility/PR/google.com/

Then, url = "http://" + url;

If you might get secure urls, add that to the route /http/google.com or /https/google.com

这篇关于在行动中输入/site.com:像http://site.com输入网址变更为http的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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