forked from nicwise/DropNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefault.aspx.cs
More file actions
47 lines (41 loc) · 1.6 KB
/
Copy pathDefault.aspx.cs
File metadata and controls
47 lines (41 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DropNet.Samples.Web
{
public partial class _Default : System.Web.UI.Page
{
////////////////////////////////////////////////////
// NOTE: This key is a Development only key setup for this sample and will only work with my login.
// MAKE SURE YOU CHANGE IT OR IT WONT WORK!
////////////////////////////////////////////////////
DropNetClient _client = new DropNetClient("9m6v782a7aeop0w", "dbd11uqce6hr8zg");
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params["dropboxcallback"] == "1")
{
//Its a callback from dropbox!
if (Session["DropNetUserLogin"] != null)
{
_client.UserLogin = Session["DropNetUserLogin"] as DropNet.Models.UserLogin;
Session["DropNetUserLogin"] = _client.GetAccessToken();
var accountinfo = _client.Account_Info();
litOutput.Text = accountinfo.quota_info.quota.ToString();
}
else
{
litOutput.Text = "Session expired...";
}
}
}
protected void btnStart_Click(object sender, EventArgs e)
{
Session["DropNetUserLogin"] = _client.GetToken();
var url = _client.BuildAuthorizeUrl(Request.Url.ToString() + "?dropboxcallback=1");
Response.Redirect(url);
}
}
}