C# 自动计算字符串公式的值(三种方式)
http://www.csframework.com/archive/2/arc-2-20110426-1394.htm
提供数据的WebForm2.aspx
- public partial class WebForm2 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string callback = Request.QueryString["jsoncallback"];
- string data = "{\"title\": \"Recent Uploads tagged cat\",\"link\": \"http://www.sina.com.cn\",\"items\": [{\"title\": \"Russell 003\",\"color\": \"red\"},{\"title\": \"Cat [07.04.11]\",\"color\": \"yellow\"}]}";
- string result = string.Format("{0}({1})", callback, data);
- Response.Expires = -1;
- Response.Clear();
- Response.ContentEncoding = Encoding.UTF8;
- Response.ContentType = "application/json";
- Response.Write(result);
- Response.Flush();
- Response.End();
- }
- }