login about faq

I am using the HTTP Download functionality to download files during a web request. It seems that if I use a loop download more than one file, the thread detaches from my web session. Is there something I can do to ensure the downloads always remain in the active thread?

asked Sep 19 '12 at 12:11

tanq's gravatar image

tanq
1222


I don't understand the question. Maybe a code snippet showing what you are doing might help?

link

answered Sep 19 '12 at 12:23

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

This is the code I'm running. If I step into it, then after the download, sometimes the debugger starts jumping back and forth between this loop and code that happens after it.

Chilkat.Http http = new Chilkat.Http();
    if (http.UnlockComponent("30-day trial"))
    {
        bool isError = false;
        string localPath = string.Empty;
        foreach (RemoteImage remoteImage in remoteImages.ImageList)
        {
            localPath = Path.Combine(imageDownloadFolder, Path.GetFileName(remoteImage.Url));
            if (!http.Download(remoteImage.Url, localPath))
            {
                //Log errors
            }
            else
            {
                remoteImage.LocalPath = localPath;
            }
        }

        if (isError)
            return Types.RemoteImageProcessingStatus.error;
    }
link

answered Sep 19 '12 at 12:49

tanq's gravatar image

tanq
1222

It appears to have been caused by breakpoints in my source. If I remove the breaks it works fine. Thanks.

link

answered Sep 19 '12 at 12:58

tanq's gravatar image

tanq
1222

edited Sep 19 '12 at 12:59

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×186
×33

Asked: Sep 19 '12 at 12:11

Seen: 1,406 times

Last updated: Sep 19 '12 at 12:59

powered by OSQA