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()); }