先要在淘宝应用写上回调地址:
我写了回调下面的页面。
GetSessionKey.aspx
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- 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 partial class TopSession_GetSessionKey : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- GetSessionkey();
- }
- ELConfig config = new ELConfig(ELConfig.Environment.taobao);
- private void GetSessionkey()
- {
- if (Request.QueryString["top_session"]==null)
- {
- Response.Redirect("http://container.open.taobao.com/container?appkey=" + config.appkey);
- }
- else
- {
- string sessionkey = Request.QueryString["top_session"].ToString();
- config.sessionkey = sessionkey;
- }
- }
- }
跳转后要用户操作确认授权才行。
授权了之后,配合上一篇文章加入到XML文件里即可。
转载于:https://blog.51cto.com/snowleung/463883