/// <summary>
        /// defaults add sessionInfo = true
        /// </summary>
        /// <param name="sUrl"></param>
        /// <param name="addSelfToHistory"></param>
        public void NavigateTo(string sUrl, bool addSelfToHistory)
        {
            string returnId    = null;
            string navigateUrl = "";

            if (IsPageModal)
            {
                MCSUrl url = new MCSUrl(sUrl);
                url.SetParameter(QS_ISPAGEMODAL, "true");
                sUrl = url.ToString();
            }

            #region Add to History
            if (addSelfToHistory)
            {
                returnId = "" + AddUrlToHistory(PageUrl.ToString());
            }
            else
            {
                returnId = returnUrlId.ToString();
            }
            #endregion



            #region Build return URL
            MCSUrl newUrl = new MCSUrl(sUrl);
            newUrl.SetParameter(MCSUrl.ReturnUrl, returnId);
            navigateUrl = newUrl.ToString();
            #endregion

            navigateUrl = Utilities.BuildURL(navigateUrl);
            Response.Redirect(navigateUrl);
        }
        private void processReturnURL()
        {
            string prevUrl = Request.QueryString[MCSUrl.ReturnUrl];

            if (prevUrl != null && prevUrl.Length > 0)
            {
                try
                {
                    long urlId = long.Parse(prevUrl);
                    try
                    {
                        prevUrl = GetUrlById(urlId);
                    }
                    catch (NoPageInHistoryException)
                    {
                        prevUrl = PageUrl.ToString();
                    }
                    returnUrlId = urlId;
                }
                catch (FormatException)
                {
                    // the parameter contains the full url.  store it in the url manager.
                    long urlId = AddUrlToHistory(HttpUtility.UrlDecode(prevUrl));
                    PageUrl.SetParameter(MCSUrl.ReturnUrl, urlId.ToString());
                    returnUrlId = urlId;
                }
            }
            else
            {
                MCSUrl eu = new MCSUrl("http://www.monet.k12.ca.us");
                prevUrl = eu.BuildURL();                 //TODO make a contstant
            }
            ClientScript.RegisterHiddenField("PreviousUrl", prevUrl);
            ClientScript.RegisterHiddenField("MyUrl", PageUrl.ToString());
            ClientScript.RegisterHiddenField("ServerUrl", Utilities.GetAppPathURL());
        }
 /// <summary>
 /// defaults include addSelfToHistory = true and add sessionInfo= true
 /// </summary>
 /// <param name="url"></param>
 public void NavigateTo(MCSUrl url)
 {
     NavigateTo(url.ToString());
 }
 /// <summary>
 /// defaults add sessionInfo = true
 /// </summary>
 /// <param name="url"></param>
 /// <param name="addSelfToHistory"></param>
 public void NavigateTo(MCSUrl url, bool addSelfToHistory)
 {
     NavigateTo(url.ToString(), addSelfToHistory);
 }
 public void SetUrlInHistory(long id, MCSUrl url)
 {
     URLManager.SetUrl(id, url);
 }