当前位置:编程学习 > C#/ASP.NET >>

求助! 关于Asp.net 站点地图程序异常

求牛人指导。。。

程序

     protected void Page_Load(object sender, EventArgs e)
     {

            SiteMap.Provider.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapResolve);
            MySiteMapNode.MySiteMapNodeInit(Server.MapPath("/StaticConfig.xml"));
      }


        private SiteMapNode SiteMap_SiteMapResolve(Object sender, SiteMapResolveEventArgs e)
        {
            if (SiteMap.Provider==null  ||  SiteMap.CurrentNode == null)
                return null;
            
            SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
            SiteMapNode tempNode = currentNode;
            LinkedList<SiteMapNode> pathNode = GetPathNodeUrlByNode(tempNode);
            query = HttpContext.Current.Request.QueryString;
            MessageContract contacte = new MessageContract();
            if (this.MyPage.Language == LanguageType.Chinese)
                contacte.Header.Language = "CN";
            if (query != null && MySiteMapNode.MapList!=null && pathNode!=null)
            {
                foreach (MySiteMapNode node in MySiteMapNode.MapList)
                {
                    foreach (SiteMapNode pnode in pathNode)
                    {
                        if (pnode.Url.ToLower() == node.Url.ToLower())
                        {
                            contacte.Body = pnode.Title;
                            pnode.Url = node.ProcessUrl(query);
                            pnode.Title = node.Processdescription(contacte, query);
                            break;
                        }
                    }
                }
            }
            return tempNode;
        }



网站出的异常是:


System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at NewGasgoo.Web.MyGasgoo.Themes.Default.Skin.Public.UC_Public_Nav.SiteMap_SiteMapResolve(Object sender, SiteMapResolveEventArgs e) at System.Web.SiteMapProvider.ResolveSiteMapNode(HttpContext context) at System.Web.SiteMapProvider.get_CurrentNode() at System.Web.SiteMapProvider.GetCurrentNodeAndHintAncestorNodes(Int32 upLevel) at System.Web.UI.WebControls.SiteMapPath.CreateControlHierarchy() at System.Web.UI.WebControls.SiteMapPath.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.default_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --------------------编程问答--------------------  有没有高手在呀? 
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,