Web Forms Settings

Web Forms Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Data.Items.Item
  • System.Xml.XmlReaderSettings
  • System.Xml.XmlReaderSettings

Web Forms Settings C# Web Control Code

Sitecore.Data.Items.Item item = this.GetItem();
if (item == null) return;

string filePath = Sitecore.IO.FileUtil.MapPath("/App_Config/Include/forms.config");

System.Xml.XmlReaderSettings readerSettings = new System.Xml.XmlReaderSettings();
readerSettings.IgnoreComments = true;
readerSettings.IgnoreWhitespace = true;
System.Xml.XmlReader xmlRead = System.Xml.XmlReader.Create(filePath, readerSettings);

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("{0}", "C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and   for space
output.Write("{0}: {1}", "Item", item.DisplayName);
output.RenderEndTag(); //

if (xmlRead.ReadToDescendant("setting"))
{
    do
    {
        output.Write("{0}&#58;&#160;{1}", xmlRead["name"], "<b>" + xmlRead["value"] + "</b><br/>");
    }
    while (xmlRead.ReadToNextSibling("setting"));
}
output.RenderEndTag(); //Div
xmlRead.Close();

Web Forms Settings C# Web Control Output

Exception.HideInner: true
WFM.DefaultDateFormat: D
WFM.OpenFormDesignerAsModalDialog: false
WFM.OpenFormDataViewerAsModalDialog: false
WFM.MasterDatabase: master
WFM.CoreDatabase: core
WFM.RemoteService: remoteWfmService
WFM.InitialValuesCacheSize: 100KB
WFM.ConnectionString: wfm
WFM.MostPopularApplicantCount: 3
WFM.RelevantScale: 0.8
WFM.BindFormCount: true
WFM.InsertIdToAnalytics: false
WFM.CommandTimeout: 180
WFM.AuditAllowedTypes: |Rich Text|html|text|Multi-Line Text|Single-Line Text|memo|
WFM.SessionThreshold: 2/1-100/60
WFM.ServerThreshold: 2/1-100/60

Sources