【问题标题】:web config string with a link asp.net webform带有链接的 web 配置字符串 asp.net webform
【发布时间】:2018-09-25 14:21:57
【问题描述】:

我的 webconfig 中有一个密钥

<add key ="ForgotPasswordPageNonMemberMessage" value ="You are not a full member and you will not be able to login. Please click here to discover more about full membership."/>

我想点击这里转到我的链接,例如 www.abeprakash.com

这可能吗?

在代码中我只是使用

lblFailureMessage.Text = ConfigurationManager.AppSettings("ForgotPasswordPageNonMemberMessage")

【问题讨论】:

  • lblFailureMessage是什么类型的控件?
  • 标签,因为我需要根据各种条件显示一些其他消息。
  • 我认为这个问题非常相似:stackoverflow.com/questions/16196680/…。一个答案建议使用字符串替换技术。不确定是否有更优雅的东西。
  • 我看过那个链接,我不认为这是一个优雅的解决方案。
  • 为什么不能在 web.config 中嵌入超链接?你只需要对其进行编码。

标签: asp.net vb.net webforms web-config


【解决方案1】:

现在这就是我所做的

<add key ="ForgotPasswordPageNonMemberMessage" value ="You are not a full member and you will not be able to login. To discover more about full membership"/>

 <asp:Label ID="ForgotPasswordPageMessage" runat="server"></asp:Label>
                    <asp:Label ID="MyWebsite" runat="server"><a href="www.abeprakash.com">cilck here</a></asp:Label>  

只需根据显示 ForgotPasswordPageMes​​sage 的条件简单地显示和隐藏 MyWebsite。

如果您有更好的方法,请提出建议。

【讨论】:

    猜你喜欢
    • 2012-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-18
    • 1970-01-01
    • 2012-06-25
    相关资源
    最近更新 更多