protected void btnInitialize_Click(object sender, EventArgs e) { try { BoxClient b = (BoxClient)Session[BOXCLIENT]; //Do a simple call to see if it works... string resp = b.JSON_Folder_GetItems(0, limit: 1); if (resp == "") { //This kicks off the authentication process Response.Redirect("https://account.box.com/api/oauth2/authorize?response_type=code&client_id=" + m_boxAppClientID + "&redirect_uri=" + HttpUtility.UrlEncode(m_boxAppRedirectURI)); } } catch (Exception ex) { jsonTextArea.Text = ex.Message + Environment.NewLine + ex.StackTrace; } }
protected void btnGetRootDirectories_Click(object sender, EventArgs e) { try { BoxClient b = (BoxClient)Session[BOXCLIENT]; string resp = b.JSON_Folder_GetItems(Int64.Parse(txtFolderID.Text), limit: int.Parse(txtLimit.Text)); if (resp == "") { Response.Redirect("https://account.box.com/api/oauth2/authorize?response_type=code&client_id=" + m_boxAppClientID + "&redirect_uri=" + HttpUtility.UrlEncode(m_boxAppRedirectURI)); } else { //Do something with the root directories JSON. jsonTextArea.Text = resp; } } catch (Exception ex) { jsonTextArea.Text = ex.Message + Environment.NewLine + ex.StackTrace; } }