Пример #1
0
 public void PushHistory()
 {
     //if (!IsPostBack)
     {
         URLHISTORY_NODE          node      = new URLHISTORY_NODE();
         System.Collections.Stack stSession = (System.Collections.Stack)Session["URLHistoryStack"];
         node.szKey = Request.FilePath.ToLower();
         node.szURL = Request.Url.ToString();
         if (stSession != null)
         {
             if (stSession.Count > 0)
             {
                 URLHISTORY_NODE topnode = (URLHISTORY_NODE)stSession.Peek();
                 if (topnode.szKey != node.szKey)
                 {
                     stSession.Push(node);
                 }
             }
             else
             {
                 stSession.Push(node);
             }
         }
         else
         {
             System.Collections.Stack stNow = new System.Collections.Stack();
             stNow.Push(node);
             Session["URLHistoryStack"] = stNow;
         }
     }
 }
Пример #2
0
 public string PopHistory()
 {
     System.Collections.Stack stSession = (System.Collections.Stack)Session["URLHistoryStack"];
     if (stSession != null)
     {
         if (stSession.Count > 1)
         {
             stSession.Pop();
             URLHISTORY_NODE topnode = (URLHISTORY_NODE)stSession.Pop();
             return(topnode.szURL);
         }
     }
     return(null);
 }