以下是我在App_Code中写的给客户端发送信息的Message类:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class Message
{
private string m_title;
private string m_description;
public Message()
{
}
public Message(string title, string description)
{
m_title = title;
m_description = description;
}
public string Title
{
get
{
return m_title;
}
set
{
m_title = value;
}
}
public string Description
{
get
{
return m_description;
}
set
{
m_description = value;
}
}
public void ShowInDialog()
{
JScript.Alert(m_description);
}
public void ShowInWebPage(string url)
{
string msgUrl = url;
msgUrl += "?title= " + m_title;
msgUrl += "&descript= " + m_description;
string encodeUrl = HttpUtility.UrlEncode(msgUrl);
System.Web.HttpContext.Current.Response.Redirect(encodeUrl);
}