Is it possible to include hyperlink in app.config key value?

梦想的初衷 提交于 2019-12-11 01:16:38

问题


Is it possible to include hyperlink as a part of text in app.config key value pair (email body text as value)? I want to generate email body from app.config key value.

For example:

<add key="EmailBody" value="Email body goes here with <a href="some link">click here</a> hyperlink/>

I know this is not valid, but is there a way to achieve this?

Thanks in advance!


回答1:


The way i would do it is write your email body as shown but do not actually add the etc. Instead, do something like the following :

<add key="EmailBody" value="Email body goes here with &&&www.google.com!!!click here£££>

Then, on the code side that is accessing / handling this key, replace &&& with :

<a href="

replace !!! with :

">

replace £££ with :

</a>

This is just an example, but gives you a little idea on how to get around the fact you cant have tags in attributes.

Hope this helps.



来源:https://stackoverflow.com/questions/16196680/is-it-possible-to-include-hyperlink-in-app-config-key-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!