using System.Text;
using System.Web;
![](/Images/OutliningIndicators/None.gif)
namespace HiDr_02.Helpers
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 程序终止类
/// </summary>
public class PromptHelper
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
Response.Write private void Echo(string s)#region Response.Write private void Echo(string s)
private static void Echo(string s)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
HttpContext.Current.Response.Write(s);
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
end private void End()#region end private void End()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// end
/// </summary>
private static void End()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
HttpContext.Current.Response.End();
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
alert javascript#region alert javascript
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// alert javascript
/// </summary>
/// <param name="s"></param>
public static void Alert(string s)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
Echo("<script language='javascript'>alert('" + s.Replace("'", @"\'") + "');history.back();</script>");
End();
}
![](/Images/OutliningIndicators/InBlock.gif)
public static void Alert(string s, string backurl)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
Echo("<script language='javascript'>alert('" + s.Replace("'", @"\'") + "');location.href='" + backurl + "';</script>");
End();
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
stop public virtual void Throw(string message)#region stop public virtual void Throw(string message)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// stop
/// </summary>
/// <param name="message"></param>
public static void Throw(string message)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
HttpContext.Current.Response.ContentType = "text/html";
HttpContext.Current.Response.AddHeader("Content-Type", "text/html");
Throw(message, null, null, null, true);
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
输出指定的提示信息 public virtual void Throw(string message, string title, string links, string autojump, bool showback)#region 输出指定的提示信息 public virtual void Throw(string message, string title, string links, string autojump, bool showback)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 输出指定的提示信息
/// </summary>
/// <param name="message">提示内容</param>
/// <param name="title">标题</param>
/// <param name="links">链拉</param>
/// <param name="autojump">自动跳转定向地址</param>
/// <param name="showback">是否显示返回链接</param>
public static void Throw(string message, string title, string links, string autojump, bool showback)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
HttpContext.Current.Response.ContentType = "text/html";
HttpContext.Current.Response.AddHeader("Content-Type", "text/html");
![](/Images/OutliningIndicators/InBlock.gif)
StringBuilder sb = new StringBuilder(template);
![](/Images/OutliningIndicators/InBlock.gif)
sb.Replace("{$Message}", message);
sb.Replace("{$Title}", (title == null || title == "") ? "系统提示" : title);
![](/Images/OutliningIndicators/InBlock.gif)
if (links != null && links != "")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
string[] arr1 = links.Split('|');
for (int i = 0; i < arr1.Length; i++)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
string[] arr2 = arr1[i].Split(',');
if (arr2.Length > 1)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (arr2[1].Trim() == "RefHref")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
arr2[1] = FetchHelper.Referrer;
}
if (arr2[1] == string.Empty || arr2[1] == null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
continue;
}
![](/Images/OutliningIndicators/InBlock.gif)
string s = ("<li><a href='" + arr2[1] + "'");
if (arr2.Length == 3)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
s += (" target='" + arr2[2].Trim() + "'");
}
![](/Images/OutliningIndicators/InBlock.gif)
if (arr2[0].Trim() == "RefText")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
arr2[0] = FetchHelper.Referrer;
}
s += (">" + arr2[0].Trim() + "</a></li>\r\n\t\t\t\t");
sb.Replace("{$Links}", s + "{$Links}");
}
}
}
![](/Images/OutliningIndicators/InBlock.gif)
if (autojump != null && autojump != string.Empty)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
string s = autojump == "back" ? "javascript:history.back()" : autojump;
sb.Replace("{$AutoJump}", "<meta http-equiv='refresh' content='3; url=" + s + "' />");
}
else
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sb.Replace("{$AutoJump}", "<!-- no jump -->");
}
![](/Images/OutliningIndicators/InBlock.gif)
if (showback)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sb.Replace("{$Links}", "<li><a href='javascript:history.back()'>返回前一页</a></li>");
}
else
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sb.Replace("{$Links}", "<!-- no back -->");
}
Echo(sb.ToString());
End();
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
//------- template -------------------------------------------------------
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
页面终止页面模板 public virtual string template#region 页面终止页面模板 public virtual string template
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 页面终止页面模板
/// </summary>
private static string template
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
get
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return @"<html xmlns:v>
<head>
<title>{$Title}</title>
<meta http-equiv='Content-Type' content='text/html; charset=" + Encoding.Default.BodyName + @"' />
<meta name='description' content='.NET类库 页面中止程序' />
<meta name='copyright' content='http://www.hidr.cn/' />
<meta name='generator' content='vs2005' />
<meta name='usefor' content='application termination' />
{$AutoJump}
<style rel='stylesheet'>
v\:* {
behavior:url(#default#vml);
}
body, div, span, li, td, a {
color: #222222;
font-size: 12px !important;
font-size: 11px;
font-family: tahoma, arial, 'courier new', verdana, sans-serif;
line-height: 19px;
}
a {
color: #2c78c5;
text-decoration: none;
}
a:hover {
color: red;
text-decoration: none;
}
</style>
</head>
<body style='text-align:center;margin:90px 20px 50px 20px'>
<?xml:namespace prefix='v' />
<div style='margin:auto; width:450px; text-align:center'>
<v:roundrect style='text-align:left; display:table; margin:auto; padding:15px; width:450px; height:210px; overflow:hidden; position:relative;' arcsize='3200f' coordsize='21600,21600' fillcolor='#fdfdfd' strokecolor='#e6e6e6' strokeweight='1px'>
<table width='100%' cellpadding='0' cellspacing='0' border='0' style='padding-bottom:6px; border-bottom:1px #cccccc solid'>
<tr>
<td><b>{$Title}</b></td>
<td align='right' style='color:#f8f8f8'>--- Dvbbs terminator</td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0' border='0' style='word-break:break-all; overflow:hidden'>
<tr>
<td width='80' valign='top' style='padding-top:13px'><span style='font-size:16px; zoom:4; color:#aaaaaa'><font face='webdings'>i</font></span></td>
<td valign='top' style='padding-top:17px'>
<p style='margin-bottom:22px'>{$Message}</p>
{$Links}
</td>
</tr>
</table>
</v:roundrect>
</div>
</body>
</html>";
}
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
}
}