protected void Page_Load(object sender, EventArgs e) { SoundCloudClient sc = new SoundCloudClient ("b7cd21ffd93dc601e76f180705b84429", "8425feac820870f86617c8607608c30e", "http://test.trackprotect.com/Social/scconnect.aspx", false); if (string.IsNullOrEmpty(Request.QueryString["code"])) { Response.Redirect(sc.GetAuthorizeUrl()); } else { sc.GetAccessToken(Request.QueryString["code"]); } }
//protected void Page_Load(object sender, EventArgs e) protected void tbGo_Click(object sender, EventArgs e) { // TODO: 2012-02-14 Emiya : Перенести в Page_Load object obj = Session[Settings.SoundCloudClientSessionKey]; if (obj == null) { string consumer_key = ConfigurationManager.AppSettings["consumerKey"]; string consumer_secret = ConfigurationManager.AppSettings["consumerSecret"]; string redirectUri = ConfigurationManager.AppSettings["redirectUri"]; const bool isDebug = false; // TODO: 2012-02-14 Emiya : после отладки удалить var client = new SoundCloudClient(consumer_key, consumer_secret, redirectUri, isDebug); string authorizeUrl = client.GetAuthorizeUrl(); Session[Settings.SoundCloudClientSessionKey] = client; Response.Redirect(authorizeUrl, true); } Session[Settings.SoundCloudClientSessionKey] = obj; Response.Redirect("~/callback.aspx", true); }