How Can We Help?
When using Power Pages, it is recommended to make use of the same set of the site configuration settings and connection strings that were configured on the Action Hub instance.
In order to make use of these settings you need to include the following using statement at the top of your code (.aspx.cs) file:
using XMPro.XMServer;
You can then make use of the Settings object to obtain configuration settings and connection strings, for example:
string setting = Settings.GetCustomSetting(Settings.Company, "<PathToConfigurationSetting>");
Examples
Connection Strings
Connection strings can be accessed by passing the path “Connections\<ConnectionStringName>”:
string xmdbConStr = Settings.GetCustomSetting(Settings.Company, @"Connections\XMDB");
Custom Settings
Custom settings can be accessed by passing the path “<CustomSettingsGroupKey>\<CustomSettingKey>”, for example, getting the path to a Report file:
string reportPath = Settings.GetCustomSetting(Settings.Company, @"Reports\SalesReport");
Application Settings
The settings object will also give you read access to the Application Settings (or Workspace Settings), such as the RepositoryDirectory, RepositoryUrl, and SmtpServer settings.
string repoDir = Settings.RepositoryDirectory; string repoUrl = Settings.RepositoryUrl; string smtpServer = Settings.SmtpServer;
Comments are closed.