LubomirMasar
asked on
How to display custom disclaimer tag from web.config on asp.net page?
I have an ASP .Net form and I want to display a disclaimer info on it from the web.config. The disclaimer can be different and customized for each customer. I want to add a custom tag in web.config like shown below..
<disclaimer>
This software....
line2 of disclaimer..
line3..
can be any number of lines..
</disclaimer>
I investigated the custom configuarion features of asp .net 2.0, but it does not allow multiline data (variable length) like this..It needs scalar values like these..
<ScottsSettings
quoteOfTheDay="Hello, World!"
yourAge="28">
<favoriteStates>
<add name="California" abbreviation="CA" />
<add name="Missouri" abbreviation="MO" />
<add name="Illinois" />
</favoriteStates>
</ScottsSettings>
Any ideas on how i could implement this?
Thanks, LM
<disclaimer>
This software....
line2 of disclaimer..
line3..
can be any number of lines..
</disclaimer>
I investigated the custom configuarion features of asp .net 2.0, but it does not allow multiline data (variable length) like this..It needs scalar values like these..
<ScottsSettings
quoteOfTheDay="Hello, World!"
yourAge="28">
<favoriteStates>
<add name="California" abbreviation="CA" />
<add name="Missouri" abbreviation="MO" />
<add name="Illinois" />
</favoriteStates>
</ScottsSettings>
Any ideas on how i could implement this?
Thanks, LM
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>In that approach, why deal with XML at all? I could write a simple text file having disclaimer content and then use System.IO streamreader class to read and display on page correct
You could. But what I showed the only difference between that and the web.config is that ConfigurationManager does the xmldocument load lines for you... You could even call it disclaimer.config if you wanted....
You could. But what I showed the only difference between that and the web.config is that ConfigurationManager does the xmldocument load lines for you... You could even call it disclaimer.config if you wanted....
ASKER
In that approach, why deal with XML at all? I could write a simple text file having disclaimer content and then use System.IO streamreader class to read and display on page correct? I had tested this and it works easily. But the customer prefers not to use a separate file, likes to use web.config for all their custom configuration.
I can also do like this
<appSettings>
<add key="DISCLAIMER_LINE1" value="Disclaimer first line"
<add key="DISCLAIMER_LINE2" value="Disclaimer second line"
<add key="DISCLAIMER_LINE3" value="Disclaimer third line"
</appSettings>
and process like this
string disclaimer = ConfigurationSettings.AppS
disclaimer = disclaimer + ConfigurationSettings.AppS
But this is a bit ugly too. We have to decide a max number of lines for disclaimer ahead of time.
Thanks for the response..I think there must be a better way..