概要:
这是学习TerryLee的Silverlight笔记-数据通信部分,关于webRequest的代码在Silverlight3有些变动。
若想学好Silverlight数据通信部分,要多看看关于web通信的相关知识,同时还有异步线程的知识。
WebRequest:
数据接口代码:
public class BookHandler : IHttpHandler
{
public static readonly string[] PriceList = new string[] {
"66.00",
"78.30",
"56.50",
"28.80",
"77.00"
};
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//webclient调用语句
//context.Response.Write(PriceList[Int32.Parse(context.Request.QueryString["No"])]);
//webRequest调用语句
context.Response.Write(PriceList[Int32.Parse(context.Request.Form["No"])]);
}
public bool IsReusable
{
get
{
return false;
}
}