2012-07-30 79 views
-1

我想动态地将https设置为我的网址。我只想在我的登录和篮子aspx文件上使用https。这里是我的代码:动态地向网址添加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一切都很好。 你有什么建议吗?

+0

您的代码正在清除调用GetDomain(true),您将不得不提供有关GetDomain(true)未被调用的更多信息。 – 2012-07-30 19:24:29

回答

0

我改变了<%#GetDomain(true)%>与<%= GetDomain(true)%>并解析。