/// <summary>
        ///     输出指定的提示信息
        /// </summary>
        /// <param name="message">提示内容</param>
        /// <param name="title">标题</param>
        /// <param name="links">链拉 例:是,yes.htm|否,no.htm</param>
        /// <param name="url">跳转页面URL</param>
        /// <param name="showback">是否显示返回链接</param>
        public virtual void Throw(string message, string title = "", string links = "", string url = "",
                                  bool showback = true)
        {
            HttpContext.Current.Response.ContentType = "text/html";

            if (!links.IsNullOrEmpty() && links.StartsWith("?"))
            {
                links = Req.GetPageName() + links;
            }

            var sb = new StringBuilder(template);

            sb.Replace("{$Message}", message);
            sb.Replace("{$Title}", title.IsNullOrEmpty() ? "System Tips" : title);

            if (!links.IsNullOrEmpty())
            {
                var arr1 = links.Split('|');
                foreach (var str in arr1)
                {
                    var arr2 = str.Split(',');
                    if (arr2.Length <= 1)
                    {
                        continue;
                    }
                    if (arr2[1].Trim() == "RefHref")
                    {
                        arr2[1] = Req.GetPrevious();
                        arr2[1] = Req.GetUrl();
                    }
                    if (arr2[1].IsNullOrEmpty())
                    {
                        continue;
                    }

                    var s = ("<li><a href='" + arr2[1] + "'");
                    if (arr2.Length == 3)
                    {
                        s += (" target='" + arr2[2].Trim() + "'");
                    }

                    if (arr2[0].Trim() == "RefText")
                    {
                        arr2[0] = Htmls.HtmlEncode(Req.GetPrevious());
                    }

                    s += (">" + arr2[0].Trim() + "</a></li>\r\n\t\t\t\t");
                    sb.Replace("{$Links}", s + "{$Links}");
                }
            }

            if (!url.IsNullOrEmpty())
            {
                var s = url == "back" ? "javascript:history.back()" : url;
                sb.Replace("{$AutoJump}", "<meta http-equiv='refresh' content='3; url=" + s + "' />");
            }
            else
            {
                sb.Replace("{$AutoJump}", "<!-- no jump -->");
            }

            sb.Replace("{$Links}",
                       showback ? "<li><a href='javascript:history.back()'>Back Page</a></li>" : "<!-- no back -->");

            Echo(sb.ToString());
            End();
        }
Exemple #2
0
 /// <summary>
 /// 记住用户最后一次访问地址
 /// </summary>
 public static void RememberUrl()
 {
     Cookies.Set(SystemConfigs.ConfigInfo.Cookies_CallBack_Url, Req.GetUrl());
 }