Developer forum

Forum » Development » The need for a Custom Settings/Config file

The need for a Custom Settings/Config file


Reply

When building modules I often have the need for storing some solution specific setting in some configuration file.

Would it be possible to have a Custom.config file in the Application root that

would NOT be overridden when updating a solution.

This file could then be accessible via som Dynamicweb.CustomConfig["key"] = value style ?

 


Replies

 
Reply

Using GlobalSettings.aspx would be an obvious choice´for that. Interacting with this file is extremely easy:

 

Base.SetGS("MyKey", "MyValu");

Base.GetGS("MyKey");

 

The first parameter is the XPath expression, so to get the database server you'd use:

 

Base.GetGS("/System/Database/SQLServer");

 
Nicolai Høeg Pedersen
Reply
ks wrote:

When building modules I often have the need for storing some solution specific setting in some configuration file.

Would it be possible to have a Custom.config file in the Application root that

would NOT be overridden when updating a solution.

This file could then be accessible via som Dynamicweb.CustomConfig["key"] = value style ?

 


Hi Kevin

 

 

You can use /Files/Globalsettings.aspx

 

Setting a value:
Base.SetGs("/Globalsettings/MyCustom/SomeModule/Somesetting", "The Value")
Reading it:
Base.GetGs("/Globalsettings/MyCustom/SomeModule/Somesetting")
 

You can even make your own control panel. Take a look at Lars' weblog section.

 
Reply
Sorensen wrote:

Using GlobalSettings.aspx would be an obvious choice´for that. Interacting with this file is extremely easy:

 

Base.SetGS("MyKey", "MyValu");

Base.GetGS("MyKey");

 

The first parameter is the XPath expression, so to get the database server you'd use:

 

Base.GetGS("/System/Database/SQLServer");


Mucho Gracias

 
Reply

Hope you found at least one of the answers helpful;)

 
Reply

Hi,

 

I tried to locate Lar's blog on how to create a control panel, but with no luck, can anyone point me out to it?

 

Regards,

Nuno

 
Reply

I'm afraid I haven't wrote sug an article. Nicolai may be confusing it with the on I wrote about security.

 

However, it's pretty simple. You create a new file in your module folder,usually naming it [ModuleSystemName]_cpl.aspx. The input fields whose values you want to save, you give them the name of the XPath you want them to represent in GlobalSettings.aspx. If you wanted to create a field that changes the SQL server, you'd set it's name attribute to "/System/Database/SQLServer".

 

You don't have to worry about saving the values. Simply setting the action attribute of your form to ControlPanel_Save.aspx will save the data in GlobalSettings.aspx.

 
Reply
Sorensen wrote:

I'm afraid I haven't wrote sug an article. Nicolai may be confusing it with the on I wrote about security.

 

However, it's pretty simple. You create a new file in your module folder,usually naming it [ModuleSystemName]_cpl.aspx. The input fields whose values you want to save, you give them the name of the XPath you want them to represent in GlobalSettings.aspx. If you wanted to create a field that changes the SQL server, you'd set it's name attribute to "/System/Database/SQLServer".

 

You don't have to worry about saving the values. Simply setting the action attribute of your form to ControlPanel_Save.aspx will save the data in GlobalSettings.aspx.


 

What does it appear in the Control Panel, and how can I give it an Icon?

I have created a ModuleFolder called MyCustomSettings and inside I have a MyCustomSettings_cpl.aspx - but how should it know to appear in the Control Panel?

 
Reply
ks wrote:
Sorensen wrote:

I'm afraid I haven't wrote sug an article. Nicolai may be confusing it with the on I wrote about security.

 

However, it's pretty simple. You create a new file in your module folder,usually naming it [ModuleSystemName]_cpl.aspx. The input fields whose values you want to save, you give them the name of the XPath you want them to represent in GlobalSettings.aspx. If you wanted to create a field that changes the SQL server, you'd set it's name attribute to "/System/Database/SQLServer".

 

You don't have to worry about saving the values. Simply setting the action attribute of your form to ControlPanel_Save.aspx will save the data in GlobalSettings.aspx.


 

What does it appear in the Control Panel, and how can I give it an Icon?

I have created a ModuleFolder called MyCustomSettings and inside I have a MyCustomSettings_cpl.aspx - but how should it know to appear in the Control Panel?

Found it - in the Module tabel i can set the path to my controlpanel settings page in the "ModuleControlPanel"-field. :)
 

 

 
Reply

Sorry, you were too fast for me to respond:)

 
Sten Hougaard
Reply

Hi,

Dont know if this has some relevance. You may read GlobalSettings.aspx values from Razor.

 

 

 

 

Med venlig hilsen/Best regards,

 

Sten Hougaard

Webudvikler

 

A: København/Aarhus . W: www.1stweb.dk

 

 

You must be logged in to post in the forum