【问题标题】:external hyper link does not work in IIS express. How do I get hyper links to reach internet?外部超链接在 IIS express 中不起作用。如何获得超链接以访问互联网?
【发布时间】:2016-09-20 10:42:57
【问题描述】:

好的,所以当您单击我的网络应用程序中的超链接时,它只会将 URL 添加到末尾。像这样http://localhost:8080/http//:www.youtube.com。我正在使用 Visual Studio .net 来制作 Web REST API。 IIS express 10 上的 Web 应用午餐。主页 URL 为 http://localhost:8080/index.html

用户获得点击链接 links are populated 用户点击链接后出错 error page

 $.ajax(
    {
        url: "/api/Link/1",
        type: "GET",
        dataType: "json",
        success: function (data)
        {
            var array = $.parseJSON(data);
            $("a").remove();
            for(var i=0;i<array.length;i++)
            {
                $("body").append("<a href=\"" + array[i].linkVal+ "\">" + array[i].name + "</a>");
            }
        },
        error: function ()
        {

        }
    });

//rest api called
[HttpGet]
    public string GetLinkList(int id)
    {
        string json = "[";
        using (StreamReader infile = new StreamReader("C: /Users/jkarp/Documents/visual studio 2015/Projects/Protal/Protal/App_Data/linkObjs.txt"))
        {
            while (!infile.EndOfStream)
                json += infile.ReadLine()+",";
        }
        if(json.Length > 1)
        {
            json = json.Remove(json.Length - 1);
            return json + "]";
        }
        return "[]";
    }

【问题讨论】:

  • 你是如何创建和显示 URL 的?
  • 我点击运行,它为我创建了本地主机,我使用标签动态创建超链接
  • 如果您需要帮助,您将不得不做得更好。展示您如何创建网址以及如何在网页上显示它。
  • 贴出动态创建标签的代码
  • @ZergRushJoe json数组是如何创建的?

标签: c# html .net visual-studio iis-express


【解决方案1】:

您的链接格式错误:

http//:www.youtube.com

冒号:放错地方了,应该是:

http://www.youtube.com

该链接将包含在您的数据源linkObjs.txt 中,在那里修复它,问题应该会消失。

【讨论】:

  • 那只是我的错字。它是“http//:www.youtube.com”
  • @ZergRushJoe 是的,这是错误的,它在您的screenshots too... 中显示为这样。应该是http:// 而不是http//:
  • 呜呜呜呜呜呜对不起
猜你喜欢
  • 2014-03-02
  • 1970-01-01
  • 2013-05-22
  • 1970-01-01
  • 1970-01-01
  • 2018-10-25
  • 2017-07-06
  • 2012-07-09
  • 1970-01-01
相关资源
最近更新 更多