Authentication Settings

Authentication Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings
  • Sitecore.Configuration.Settings.Authentication
  • Sitecore.Context
  • Sitecore.Data.Items.Item

Authentication Settings C# Web Control Code

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

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("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(); //P

string accountNameValidation = Sitecore.Configuration.Settings.AccountNameValidation;
string clientLoginDuration = Sitecore.Configuration.Settings.Authentication.ClientPersistentLoginDuration.ToString();
string defaultDomainName = Sitecore.Configuration.Settings.Authentication.DefaultDomainName;
string defaultMembershipWildcard = Sitecore.Configuration.Settings.Authentication.DefaultMembershipProviderWildcard;
string saveRawUrl = Sitecore.Configuration.Settings.Authentication.SaveRawUrl.ToString();
string virtualMembershipWildcard = Sitecore.Configuration.Settings.Authentication.VirtualMembershipWildcard.ToString();

output.Write("{0}&#58;&#160;{1}", "Account Name Validation", "<b>" + accountNameValidation + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Client Persistent Login Duration", "<b>" + clientLoginDuration + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default Domain Name", "<b>" + defaultDomainName + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default Membership Provider Wildcard", "<b>" + defaultMembershipWildcard + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Save Raw Url", "<b>" + saveRawUrl + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Virtual Membership Wildcard", "<b>" + virtualMembershipWildcard + "</b>");

output.RenderEndTag(); //Div


Authentication Settings C# Web Control Output

Account Name Validation: ^\w[\w\s]*$
Client Persistent Login Duration: 180.00:00:00
Default Domain Name: default
Default Membership Provider Wildcard: %
Save Raw Url: False
Virtual Membership Wildcard: *