Web.config Considerations

As part of the Monarch Framework, there are two configuration files that enable applying text values to the DDS button labels on a global basis. Although DdsFile provides some properties for setting these values at design time, the Web.config file and the AppSettings.config file provide a method to establish these values definitively.

The display text for function keys can be provided in two separate places: the Web.config file and the FuncKeys property on DdsFile. Note that even if the key is not enabled (no Response:Option Indicator is provided), the Text entered will be used as the default label for that Display file. This label takes precedence over whatever is found in Web.config.

Each record format also provides FuncKeys and AttnKeys properties where text can be entered for individual keys. Their property values text is only used if the record format enables that key. There is no real mechanism to provide text for "enter" and "reset" because these keys cannot be "enabled" by a record format (or file). The EnterText and ResetText properties have been provided to allow text values to be established for these two keys. In addition, the CssEnterClass property can be used to contain the name of the cascading style sheet class that controls the appearance of these keys. You can also set the BannerStyle property to Hidden to hide all functions keys except "enter" and "reset".

Under all conditions, if the property is set, the value entered will be used. If not, the Web.Config file is checked and any value found for the button will be used; otherwise English labels will be used.

Processing Rules

During internal migration and within Visual Studio, the following rules apply:

  • The Web.config file contains a "file=" attribute on the appSettings section that is a relative path (migrated to the same folder as Web.config).
  • If the Migrator removes AppSettings.config provided as a template, then Cocoon does not insert the "file=" attribute on the appSettings section of Web.config.
  • The setting for key="MonarchMessageFileFolder" (generated by Monarch if the Website uses at least one Message file), is added to the appSettings section directly into Web.config (as opposed to the external file AppSettings.config). Note: The value for "MonarchMessageFileFolder" allows the use of the symbol "~", as in value="~\Monarch MsgFiles\" to specify the website "root" and make this a relative reference instead of an absolute path location.
  • When the Website runs, any settings in Web.config are merged with the settings defined in AppSettings.config.
  • If there are duplicate keys (i.e. in Web.config and AppSettings.config), the Website will throw an exception during startup and will not run until fixed.
  • If Web.config is modified while the Website runs, the Website is re-started automatically.
  • If AppSettings.config is modified while the Website runs, the Website does not automatically restart; changes in the settings take effect after the Website is re-started by any means.

Web.config File

A partial sample of a Web.config File is provided below as it pertains to this topic:

   <configuration>
       <configSections>
           . . .
       </configSections>
       <appSettings file="AppSettings.config">
            <add key="MonarchMessageFileFolder" value="~\Monarch MsgFiles\" />
       </appSettings>   
       <MonarchFileOverrides>
            . . .   
      </MonarchFileOverrides>
      <system.web>
           <compilation debug="true" >
                <assemblies>
                  . . .                     
               </assemblies> 
          </compilation>
        </system.web>
   </configuration>

appSettings.config File

A sample of an appSettings.config File is provided below containing only the basic instructions to establish the key values and general guidelines to assess the values settings within your code. This file is provided as a template at $InstalDir\Templates\AspWebApp.

<
<appSettings>
    !-- DISPLAY FILE CUSTOMIZATION.
        To change the text to be displayed for function keys and other DdsRecord buttons,
        add entries using the following format: 
          <add key="KEYNAME" value="KEYTEXT"/>
        where KEYNAME has the format: MonarchKeyXXXXX (case sensitive)
          and XXXX is F1...F24, Clear, Enter, Help, PageUp, PageDown, Print, or Reset.
      Examples:      
       <add key="MonarchKeyF1"  value="PF1"/>
        ...
       <add key="MonarchKeyF24"      value="PF24"/>
       <add key="MonarchKeyClear"    value="CLR"/>
       <add key="MonarchKeyEnter"    value="Submit"/>
       <add key="MonarchKeyHelp"     value=" ? "/>
       <add key="MonarchKeyPageUp"   value="Roll Down"/>
       <add key="MonarchKeyPageDown" value="Roll Up"/>
       <add key="MonarchKeyPrint"    value="PRT"/>
       <add key="MonarchKeyReset"    value="RST"/> 
   -->
   <!--  YOUR APPLICATIONSETTINGS GO HERE. Note: the key name is case-sensitive.
       <add key="MySetting" value="The value of MySetting" /> 
 </appSettings>

In your code, you can retrieve the setting using the following system class.

DclFld appSettings Type(System.Configuration.AppSettingsReader)        
DclFld mySetting Type(*String)
 // Instantiate application settings reader class (do it only once in your application)                
   appSettings = *new System.Configuration.AppSettingsReader()  
 // Using the applications settings reader object, get the value of the key configured.
   mySetting = appSettings.GetValue( "MySetting" , *TypeOf(*String)) *As *String 

Next: Adding Web.Config Manually

Previous: Display File Overview