Http://www.csframework.com/archive/2/arc-2-20110426-1394.htm
Webform2.aspx to provide data
[CSharp]View PlainCopy
- 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 ();
- }
- }
C # automatically calculates the value of a string formula (three ways)