Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm in a ASP.NET project where I need to give several parameters to the administrator that is going to install the website, like:

AllowUserToChangePanelLayout
AllowUserToDeleteCompany

etc...

My question is, will be a good thing to add this into the web.config file, using my own configSession or add as a profile varibles? or should I create a XML file for this?

What do you do and what are the cons and favs?

I originally thought about web.config but I then realized that I should mess up with Website configurations and my own web app configuration and that I should create a different file, them I read this post and now I'm on this place... should I do this or that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
198 views
Welcome To Ask or Share your Answers For Others

1 Answer

I usually use Settings - available via the project properties - Settings. These can be edited and saved in code, and I write a form / web page to edit them.

If you want to use the XML configuration, there's an attribute called file that reads external files. You could have a web.config file and a someothername.config file. The someothername.config would have settings like:

<appSettings>
    <add key="ConnString" value="my conn string" />
    <add key="MaxUsers" value="50" />
</appSettings>

And the web.config would have

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings file="ExternalWeb.config">
        <add key="MyKey" value="MyValue" />
    </appSettings>
</configuration>

See DevX for the example I stole.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...