cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We recently received a question asking for advice on how to set up a Dropbox account for an elderly family member. This prompted us to think about the different ways we can make Dropbox more accessible in general, learn about it and add your tips right over here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

Asp.net Web Forms obtain access token in ReturnURI page

Asp.net Web Forms obtain access token in ReturnURI page

sanjayssk
Helpful | Level 6

I'm trying to use Dropbox .Net from an asp.net Web Forms application. I'm successfully able to get control in my ReturnURI web page. But I can't find any sample code on how to proceed further to obtain the AccessToken in Page_Load of that page. Please help or at least give a pointer to the sample code. The examples are not for Web Forms.

 

Thanks.

1 Accepted Solution

Accepted Solutions

Re: Asp.net Web Forms obtain access token in ReturnURI page

Greg-DB
Dropboxer
You can see how the authorization code is exchanged for an access token in the .NET SDK SimpleBlogDemo example here:

https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleBlogDemo...

The 'code' and 'state' are returned by URL parameters, and after the 'state' is validated, you can use 'ProcessCodeFlowAsync' to exchange the 'code' for an access token.

View solution in original post

5 Replies 5

Re: Asp.net Web Forms obtain access token in ReturnURI page

Greg-DB
Dropboxer
You can see how the authorization code is exchanged for an access token in the .NET SDK SimpleBlogDemo example here:

https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleBlogDemo...

The 'code' and 'state' are returned by URL parameters, and after the 'state' is validated, you can use 'ProcessCodeFlowAsync' to exchange the 'code' for an access token.

Re: Asp.net Web Forms obtain access token in ReturnURI page

sanjayssk
Helpful | Level 6

Hi Greg,

 

Thanks for the hint. However, that code was still MVC and I have never done any async stuff in Web Forms. So I had to do some research. Finally, I was able to get the access token. Now I can try the API in Web Forms.

 

Many thanks,

Sanjay

Re: Asp.net Web Forms obtain access token in ReturnURI page

olavolsf
Explorer | Level 3

Dear Sanjay,

 

Would you be so kind to send me the webform code to access "access tokens"? I am also a webforms programmer and I am having problem translating the dropbox example from MVC.

 

Many thanks in advance.

Re: Asp.net Web Forms obtain access token in ReturnURI page

sanjayssk
Helpful | Level 6

It was so long back that I have lost all those sources. However, I remember doing something with DotNetOpenAuth, DropNet and NewtonSoft.json.

 

I just now searched and found some things that might help:

https://github.com/DropNet/DropNet

https://stackoverflow.com/questions/38432377/asp-net-file-upload-to-dropbox-via-api

Re: Asp.net Web Forms obtain access token in ReturnURI page

olavolsf
Explorer | Level 3

Thank you very much, sanjayssk.

 

I will access the links you recomended and try to get something from there.

 

Best regards.

Who's talking

Top contributors to this post

  • User avatar
    olavolsf Explorer | Level 3
  • User avatar
    sanjayssk Helpful | Level 6
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?