user.config question

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
2/20/2012 7:39:50 AM
Gravatar
Total Posts 40

user.config question

What's the best way to get the values of keys stored in the user.config file in a .aspx.cs page?

2/21/2012 10:59:10 AM
Gravatar
Total Posts 18439

Re: user.config question

We have some helper methods. 

Suppose you have:

<add key="MyString" value="foo" />
<add key="MyBool" value="true" />
<add key="MyInt" value="12" />

using mojoPortal.Web.Framework;

string myString = ConfigHelper.GetStringProperty("MyString", "defaultToUseIfNotFound");

bool myBool = ConfigHelper.GetBoolProprty("MyBool", true);

int myInt = ConfigHelper.GetIntProperty("MyInt", -1);

In all cases the second param is a default value in case the setting is not found.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.