login about faq

Hi. I have a coding question.

Chilkat.Http rthttp = new Chilkat.Http();
for (int lp1 = 0; lp1 < numurls; lp1++)
{
   string url = urllist[lp1];
   string s1 = rthttp.QuickGetStr(url);
   int i1 = rthttp.LastStatus
}

Eventually .LastStatus will return something other than 200 but the website is fine.

This problem never occurred until I had the same domain name in urllist[] more than once.

When I move "Chilkat.Http rthttp = new Chilkat.Http();" the problem goes away as follows.

for (int lp1 = 0; lp1 < numurls; lp1++)
 {
    string url = urllist[lp1];
    Chilkat.Http rthttp = new Chilkat.Http();
    string s1 = rthttp.QuickGetStr(url);
    int i1 = rthttp.LastStatus
 }

I am a bit of a novice programmer when it comes to all this and was wondering if there are some sort of "best practice" or standards I am missing. Should I always create a new instance in this case?

I debugged this problem surprisingly quickly (at least to me it was quickly), but I am getting into more and more complex coding and want to minimize needless debug time as much as possible. Any suggestions are welcome.

Thanks!

asked Jun 15 '12 at 09:46

nomadicus's gravatar image

nomadicus
46335


Examine the contents of the rthttp.LastErrorText after calling QuickGetStr. Make sure to get the LastErrorText before accessing the LastStatus property, otherwise the LastErrorText may be overwritten by the property access. The LastErrorText should provide more detailed information.

Also, one of the first lines of information in the LastErrorText is the "DllDate". If it is older than the latest version, which at the time of this post is approx. April 2012, then first download and use the very latest version of the Chilkat component.

link

answered Jun 15 '12 at 10:39

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

I am using your LastErrorText suggestion now and in the future. The dll was up to date.

The http errors I had turned out to be a symptom, not the cause. Turned out to be StringArray I reloaded from text several times. I inserted a .clear and I am good in good shape now.

Thank you for the fast response!

link

answered Jun 15 '12 at 21:39

nomadicus's gravatar image

nomadicus
46335

Followup question. Was wondering about garbage collection . . . The "using" statement in C# is for IDisposable objects. Does that apply to Chilkat.http?

link

answered Jun 16 '12 at 18:22

nomadicus's gravatar image

nomadicus
46335

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

Asked: Jun 15 '12 at 09:46

Seen: 1,378 times

Last updated: Jun 16 '12 at 18:22

powered by OSQA