【问题标题】:adding https dynamically to url将 https 动态添加到 url
【发布时间】:2012-07-30 16:29:48
【问题描述】:

我想动态地将 https 设置为我的网址。我只想在我的登录名和购物篮 aspx 文件上使用 https。这是我的代码:

在 html 文件中:

   <span runat="server" id="spnGiris"><a href="<%#GetDomain(true)%>/Login.aspx">Personel
                Girişi&nbsp;&nbsp;</a></span>
<a href="<%#GetDomain(false)%>/Default.aspx?q=e">Çıkış</a></span>

在服务器端:

 public string GetDomain(bool https)
    {
        string protocol = https ? "https" : "http";
        string s = Request.Url.Host.ToLower();
        if (s.Equals("localhost"))
            return protocol + "://localhost:14553";
        return protocol + "://" + ConfigurationManager.AppSettings["domainName"];
    }

我在 GetDomain 上设置了断点,而 https 在 login.aspx 中始终为 false。但在篮子.aspx 中一切正常。 你有什么建议吗?

【问题讨论】:

  • 您的代码正在清除调用 GetDomain(true),您必须提供有关未调用 GetDomain(true) 原因的更多信息。

标签: .net c#-4.0 https ssl-certificate


【解决方案1】:

我将 更改为 并解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多