输入网址(例如http://example.com)在操作输入中更改为http:/example.com [英] Input URL like http://example.com changes to http:/example.com in action input

查看:835
本文介绍了输入网址(例如http://example.com)在操作输入中更改为http:/example.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问了一个问题,以获取URL作为操作输入此处.现在我有一个新问题.传递给操作的URL从http://example.com更改为http:/example.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://example.com to http:/example.com.

我想知道为什么以及如何解决该问题.

P.S:我添加了此代码来解决,但我认为将来可能还会有其他问题!代码是:

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

(在Chrome中为)

(in Chrome) goes to:

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

如果我是你,我会从您的路径中删除http://,然后再添加.

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

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

然后,url = "http://" + url;

如果您可能会获得安全的网址,请将其添加到路由/http/example.com/https/example.com

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

这篇关于输入网址(例如http://example.com)在操作输入中更改为http:/example.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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