Multi line text in a Web.Config file

人盡茶涼 提交于 2019-12-10 17:23:06

问题


I need to display a welcome message on a webpage. I'd like to have the text of the message saved within the Web.Config file. The text will contain line breaks.

e.g.

<appSettings>
<add key="Test" value="Hello 

     There

     How are you?"/>
</appSettings> 

However when I display this it all goes back on 1 line.

Can anybody help?

I'm using ASP.Net 4.0

Thanks in advance


回答1:


You can do it as Niek said but I prefer the Constants to be in your Application: App_GlobalResources or App_LocalResources.

Then you can have multiple languages support and everything clean... but if you dont want to rebuild every time you change in the constants then you can put the text in the database or xml file.

Appsettings in web.config are more for settings in an application



来源:https://stackoverflow.com/questions/10652751/multi-line-text-in-a-web-config-file

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