Click here to Skip to main content
15,908,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have sitemap (web.sitemap) , and use Master/content page

I use function ,

as

C#
private SiteMapNode ExpandForumPaths(Object sender, SiteMapResolveEventArgs e)
    {
        
        if (SiteMap.CurrentNode != null)
        {
            SiteMap.SiteMapResolve -= new SiteMapResolveEventHandler(this.ExpandForumPaths);

            SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
            SiteMapNode tempNode = currentNode;

            if ((tempNode = tempNode.ParentNode) != null)
            {
                string hlist = tempNode.ParentNode.Url;
                tempNode.Title = "Hotel Details";

                //if (Request.UrlReferrer != "")
                HttpContext context = HttpContext.Current;
                string baseUrl = context.Request.Url.ToString();

              //  if (Request != null)
             //   {
                    try
                    {
                        ViewState["GoBackTo"] = HttpContext.Current.Request.UrlReferrer;
                    }
                    catch (Exception etr)
                    {
                        string excpt = etr.ToString();
                    }
             //   }

                //string vurl = ViewState["GoBackTo"].ToString();
                tempNode.Url = ViewState["GoBackTo"].ToString();
                Session["HotellistDetails"] = ViewState["GoBackTo"].ToString();
                tempNode.ParentNode.Url = Session["Hotellistlinks"].ToString();
            }

            if ((tempNode = tempNode.ParentNode.ParentNode) != null)
            {
                HttpContext context1 = HttpContext.Current;
                string baseUrl1 = context1.Request.Url.ToString();

                ViewState["GoBackTo"] = HttpContext.Current.Request.UrlReferrer;
                string vurl1 = ViewState["GoBackTo"].ToString();
                //tempNode.Url = Session["Hotellistlinks"].ToString();

            }

            return currentNode;
        }

        return SiteMap.CurrentNode;
    }


to set each node title and url

should i give the above function in each content page ...
or in master page
Posted
Updated 15-Jan-14 19:27pm
v2
Comments
Sampath Lokuge 16-Jan-14 1:30am    
You should handle that in master page.What happen when you give it in master page ?
maulikshah1990 16-Jan-14 1:41am    
I use above funtion in all content pages i call , and in page_load , i give SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(this.ExpandForumPaths);

When i use Request.Urlreferrer ,
it gives me sometimes error in Request

request is not available in this context
maulikshah1990 16-Jan-14 2:26am    
waiting for reply for any one

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900