Multi line text in a Web.Config file

2019-06-26 07:23发布

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条回答
Evening l夕情丶
2楼-- · 2019-06-26 08:07

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

查看更多
登录 后发表回答