public static RenRenApi GetInstanceByHttpContext(IRenRenHandler ih, HttpContextBase httpContext, string secret) { ih.IsDebug = false; var sessionKey = httpContext.Request.QueryString["xn_sig_session_key"]; sessionKey = httpContext.Server.UrlEncode(sessionKey); var apiKey = httpContext.Request.QueryString["xn_sig_api_key"]; return(new RenRenApi(apiKey, secret, sessionKey, ih)); }
//http://apps.renren.com/iloveyourhome/?origin=903& //xn_sig_in_iframe=1 //&xn_sig_method=get //&xn_sig_time=1244437143581 //&xn_sig_added=1 //&xn_sig_user=45102821 //&xn_sig_session_key=2.f3499092760dc4350271386376475612.3600.1244440800-45102821 //&xn_sig_expires=0 //&xn_sig_api_key=7b4862666bad4eccb1f9053048b23428 //&xn_sig_app_id=31802 //&xn_sig_in_iframe=1 public RenRenApi(string apiKey, string secret, string sessionKey, IRenRenHandler handler) { //HttpContext = httpContext; Cache = new Dictionary <string, string>(); ApiKey = new KeyValuePair <string, string>("api_key", apiKey); Secret = secret; Version = new KeyValuePair <string, string>("v", "1.0"); SessionKey = new KeyValuePair <string, string>("session_key", sessionKey); Handler = handler; //PostData = string.Format("api_key={0}&session_key={1}&v={2}", ApiKey, Secret, Version); }