在MVC 4中使用Dropbox [英] Using Dropbox in MVC 4

查看:102
本文介绍了在MVC 4中使用Dropbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我的MVC4应用程序中有一个要求,我需要在dropbox上传一些文件。

请建议我任何好的Api,并有一些很好的代码示例。

我已经尝试了API http: //cgeers.com/2012/03/17/dropbox-rest-api-part-6-oauth-callback/ [ ^ ];但是它给出了一些错误。

有许多样本,但它们适用于Asp.Net。



请建议我可以遵循的方法和一些很好的API将DropBox集成到MVC 4 App中。



编辑:要求就像我有一个页面,可以选择登录Dropbox。当用户单击登录时,应打开一个新选项卡或弹出窗口,要求用户允许或拒绝DropBox。如果用户允许,则会将其重定向到登录页面。用户登录Dropbox后,选项卡或弹出窗口将关闭或重定向回主站点。在此之后,上传将在后台完成。



我如何实现整个场景?



我想在用户弹出一个视图点击登录Dropbox的选项。当用户允许或拒绝时,它将导航到视图的回调URL。这将在我的控制器中调用action方法。在这里,我可以确定URL中附加的参数是空/空还是包含一些值。如果它包含某个值,则表示用户已允许。此外,当用户点击登录Dropbox的选项时,我将在我的控制器中启动一个计时器,它将每隔几秒调用一次DropBox方法,以了解凭据是否经过身份验证。一旦知道凭证经过身份验证,计时器就会停止。定时器只运行5分钟。与此同时,我将关闭弹出窗口。此外,当用户允许DropBox时,我需要更改登录按钮的文本(用户单击以启动此过程)。但是我不知道怎么做。



如果这种方法还可以,请告诉我。



谢谢。

Hello,

I have a requirement in my MVC4 App where i need to upload some files on dropbox.
Please suggest me any Api which is good and have some good code samples.
I have tried the API http://cgeers.com/2012/03/17/dropbox-rest-api-part-6-oauth-callback/[^]; but it is giving some error.
There are many samples but they are for Asp.Net.

Please suggest the approach i can follow and some good APIs to integrate DropBox in MVC 4 App.

The requirement is like I have a page with an option to login to Dropbox. When user clicks Login, a new tab or popup should open where user is asked to allow or deny DropBox. If user allows, it is redirected to login page. After user logins in Dropbox, the tab or popup closes or redirect back to main site. After this the uploading will be done in background.

How can i achieve the whole scenario?

I thought of opening a view in popup when user clicks on option to login to Dropbox. When user will either allow or deny, it will navigate to a callback URL of a view. this will call action method in my controller. Here i can identify if parameters appended in URL are empty/null or contain some value. If it contains some value, it means user has allowed. Also, when user clicks on option to login to Dropbox, I will initiate a timer in my controller, which will call a DropBox method every few seconds to know if the credentials are authenticated. Once it come to know that credentials are authenticated, timer will be stopped. Timer will run only for 5 minutes. at the same time, i will close popup. Also, i need to change the text of that Login button (where user clicks to start this process) when user allows DropBox. but i don't know how to do it.

Please let me know if this approach is Okay.

Thanks.

推荐答案

尝试下面的Dropbox API的.NET客户端库

SharpBox [ ^ ]

DropNet [ ^ ]
try below .NET client libraries for the Dropbox API
SharpBox [^]
DropNet[^]


这篇关于在MVC 4中使用Dropbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆