1.下载官网demo(参考第四个demo)

导入TopSpace.Bll.dll



2.复制以下类

Client.cs,Config.cs



3.在web.config的<appSettings>下面加入

<add key="SandBox" value="0"/>


<add key="AppKey" value="12510432"/>


<add key="AppSecret" value="..密码不便公布.."/>





4.添加代码



TopAPI.AppKey = Config.Appkey;

TopAPI.AppSecret = Config.Secret;

TopAPI.RestUrl = Config.ServerURL;



Item item = new Item();//定义返回商品对象

Parser parser = new Parser();//定义解析XML对象

ErrorRsp err = new ErrorRsp();//定义错误对象



Dictionary<string, string> param = new Dictionary<string, string>();

param.Add("fields", "detail_url,num_iid,title,nick,type");

param.Add("num_iid", "7969802699");//商品字符串ID。iid和num_iid选择一个传入

string strXml = TopAPI.Post("taobao.item.get", Client.Session, param);

ItemResponse rsp = new ItemResponse();//定义输出商品结构对象



parser.XmlToObject2(strXml, "item_get", "item", item, err);

Response.Write(item.title);