cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Check out the Dropbox cheat sheet for getting started in 2021 here!

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dropbox & ASP.NET integration

Dropbox & ASP.NET integration

Explorer | Level 3

Hi,

I'm using  dropbox.api for c# for downloading files.

in the console project it works perfectly but in the ASP.NET (for now localhost server)

is get stuck in dbx.Files,DownloadAsync Method.

here's the code(very simple:disappointed face:

private async Task _Download(string folder, string file, string destination)
        {
            using (var response = await dbx.Files.DownloadAsync( "/"  + folder + "/" + file))
            {
                using (var fileStream = File.Create(destination))
                {
                    (await response.GetContentAsStreamAsync()).CopyTo(fileStream);
                }               
            }
        }

As i  said, it works in Console Project but not in ASP.NET project

5 Replies 5

Re: Dropbox & ASP.NET integration

Dropboxer

Can you clarify what you mean when you say "is get stuck in dbx.Files,DownloadAsync Method"?

Are you getting any error or output? 

Re: Dropbox & ASP.NET integration

Explorer | Level 3

I'm not getting any error nor output

the program stop responding in the line: using (var response = await dbx.Files.DownloadAsync( "/"  + folder + "/" + file)) with no excpetion being thrown

in app console it works great but in ASP.NET it get stuck

 

Re: Dropbox & ASP.NET integration

Dropboxer

Thanks for following up. There doesn't appear to be anything wrong in the code you posted, so there are a few things to check next:

  • is there anything on your network connection, e.g., proxy, firewall, anti-virus, or other security software, that may be interfering with the connection?
  • how big is the file that you're trying to download?
  • how are you determining which line is hanging? Did you step through with the debugger?

Re: Dropbox & ASP.NET integration

Explorer | Level 3

Q: is there anything on your network connection, e.g., proxy, firewall, anti-virus, or other security software, that may be interfering with the connection?

A: I've disabled  all firewall and anti virus, no change. the console and the asp.net runs on the same copmuter(my pc). I've created a library that uses the DropboxAPI, and i use this library in both console and ASP.NET, which ,as i said , int console it works and in asp.net it didn't.

 

Q: how big is the file that you're trying to download?

A: 1mb(at most)

Q: how are you determining which line is hanging? Did you step through with the debugger?

A: Yes, i 've debugged the code the line which the code is hanged is: using (var response = await dbx.Files.DownloadAsync( "/"  + folder + "/" + file)) 

Re: Dropbox & ASP.NET integration

Dropboxer

Thanks for those answers. We'll need to troubleshoot this further.

If you pause execution while the program is hung and "step into" the "DownloadAsync" line, where in the Dropbox SDK exactly is it hung?

Polls
Are you starting new work habits this year?

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?