One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
sanjayssk
8 years agoHelpful | Level 6
Asp.net Web Forms obtain access token in ReturnURI page
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.
- 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/Controllers/HomeController.cs#L187
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.
- Greg-DB
Dropbox Staff
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/Controllers/HomeController.cs#L187
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.- sanjaysskHelpful | 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
- olavolsfExplorer | 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.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 9 hours ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!