Occasionally we see following error and when user login again it goes away. We are using following code. There are around 3-4 users out of 1000 who actually encounter this issue that too did not encounter it again.
if (!Page.IsPostBack) { string _menu = string.Empty; try { if (_isAuthorized) { _menu = Session["Menu"] as string; if (string.IsNullOrEmpty(_menu)) { DateTime _startTime = DateTime.Now; _menu = _adapter.GetMenu(_userName, _applicationName, _regionName); DateTime _endTime = DateTime.Now; TimeSpan ts = new TimeSpan(_endTime.Ticks - _startTime.Ticks); double ms = ts.Milliseconds; Trace.Warn("Total milliseconds taken to fetch MENU " + ms.ToString() + " milliseconds"); Session["Menu"] = _menu; } if (!string.IsNullOrEmpty(_menu)) { xmlDataSource = new XmlDataSource(); xmlDataSource.Data = _menu; xmlDataSource.EnableCaching = false; if (this.IsTreeView) { treeViewAdmin.DataSource = xmlDataSource; treeViewAdmin.DataBind();
TreeNode cognosRpt = new TreeNode(); cognosRpt.Text = "Cognos Reporting"; cognosRpt.NavigateUrl = ConfigurationManager.AppSettings.Get("CognosReportingURL"); cognosRpt.Target = "_blank";
TreeNode refDoc = new TreeNode(); refDoc.Text = "Reference Documents";
TreeNode chAEFP = new TreeNode(); chAEFP.Text = "AEFP 7.02"; chAEFP.NavigateUrl = ConfigurationManager.AppSettings.Get("AEFPURL"); chAEFP.Target = "_blank";
TreeNode chCFT = new TreeNode(); chCFT.Text = "CFT Online"; chCFT.NavigateUrl = ConfigurationManager.AppSettings.Get("CFTURL"); chCFT.Target = "_blank";
TreeNode chProcessDoc = new TreeNode(); chProcessDoc.Text = "Process Documents"; chProcessDoc.NavigateUrl = ConfigurationManager.AppSettings.Get("ProcessDocURL"); chProcessDoc.Target = "_blank";
refDoc.ChildNodes.Add(chAEFP); refDoc.ChildNodes.Add(chCFT); refDoc.ChildNodes.Add(chProcessDoc); treeViewAdmin.Nodes.Add(cognosRpt); treeViewAdmin.Nodes.Add(refDoc);
treeViewAdmin.Enabled = true; menuAdmin.Enabled = false; } else { menuAdmin.DataSource = xmlDataSource; menuAdmin.MaximumDynamicDisplayLevels = 20; menuAdmin.DataBind();
MenuItem mnCognosRpt = new MenuItem("Cognos Reporting", "Cognos", "", ConfigurationManager.AppSettings.Get("CognosReportingURL"), "_blank"); menuAdmin.Items.Add(mnCognosRpt);
MenuItem mnRefDoc = new MenuItem("Reference Documents"); MenuItem mnchAEFP = new MenuItem("AEFP 7.02", "AEFP", "", ConfigurationManager.AppSettings.Get("AEFPURL"), "_blank"); MenuItem mnchACFT = new MenuItem("CFT Online", "CFT", "", ConfigurationManager.AppSettings.Get("CFTURL"), "_blank"); MenuItem mnchProcessDoc = new MenuItem("Process Documents", "ProcessDoc", "", ConfigurationManager.AppSettings.Get("ProcessDocURL"), "_blank");
mnRefDoc.ChildItems.Add(mnchAEFP); mnRefDoc.ChildItems.Add(mnchACFT); mnRefDoc.ChildItems.Add(mnchProcessDoc); menuAdmin.Items.Add(mnRefDoc);
menuAdmin.Enabled = true; treeViewAdmin.Enabled = false; } } } } I am also attaching trace log for the same.
<Message> Error Information -------------------- 1 Exception Details -------------------- Error Code :5015 Severity Code :4 Message :There are multiple root elements. Line 1, position 205. Error Type ystem.Xml.XmlException Source ystem.Xml Stack trace -------------------- at System.Xml.XmlTextReaderImpl.ThrowException e at System.Xml.XmlTextReaderImpl.ThrowString res, String arg at System.Xml.XmlTextReaderImpl.ThrowInt32 pos, String res at System.Xml.XmlTextReaderImpl.ParseDocumentContent at System.Xml.XmlTextReaderImpl.Read at System.Xml.XmlLoader.LoadDocSequenceXmlDocument parentDoc at System.Xml.XmlLoader.LoadXmlDocument doc, XmlReader reader, Boolean preserveWhitespace at System.Xml.XmlDocument.LoadXmlReader reader at System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocumen tXmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency at System.Web.UI.WebControls.XmlDataSource.GetXmlDocument at System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Se lect at System.Web.UI.WebControls.TreeView.DataBindNodeTreeNode node at System.Web.UI.WebControls.TreeView.PerformDataBinding at System.Web.UI.WebControls.HierarchicalDataBoundControl.Per formSelect at System.Web.UI.WebControls.BaseDataBoundControl.DataBind at System.Web.UI.WebControls.TreeView.DataBind at AmericanExpress.Attestation.WP.MasterPage.Page_LoadObject sender, EventArgs e </Message>
Any guess why it happens?
Looking forward for some greate replies.
Thanks in advance.
|