Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 948125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:11:32+00:00 2026-05-15T23:11:32+00:00

I have an application which uses Webbrowser control to navigate to a few vendor

  • 0

I have an application which uses Webbrowser control to navigate to a few vendor sites and scrape reporting. Because there are several accounts with one vendor, I need to have the browser end its session and clear any set cookies. I am using API calls to wininet.dll for both and am able to achieve the desired result. However, intermittently, I get what appears to be a deadlock on the InternetSetOption for INTERNET_OPTION_END_BROWSER_SESSION.

It is very linear code and InternetSetOption is called from a single thread in one place. What makes it difficult to figure out is that while running in debug, I’ve only very rarely been able to reproduce the problem. As soon as I compile and run outside of VS, it will happen shortly after. I isolated it to that by pumping messages to the console as it runs.

The few times I’ve been able to catch the problem while debugging, it just shows InternetSetOption as the next statement and sits, no exceptions or errors, nothing in the output window. InternetSetOption should return boolean, but the program will go no further and I never get any return from the API call. I tried look at the last error message thrown, but in this case it doesnt help, as it never throws an error.

Anyone have any input as to what I can further do to debug this?

Declared as:

[DllImport("wininet.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool InternetSetOption(
    IntPtr hInternet,
    int dwOption,
    IntPtr lpBuffer,
    int lpdwBufferLength);

And called by:

InternetSetOption(IntPtr.Zero, 42, IntPtr.Zero, 0);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:11:33+00:00Added an answer on May 15, 2026 at 11:11 pm

    For anyone who comes across this and, by chance, has the same issue – the problem appears to be caused by a function I had found on MSDN’s site for clearing cache and cookies. found here.

    There were several issues in that ClearCache() function, one being between x86 and x64 and how it referenced the cache files to delete them –

    In the current function, it calles DeleteUrlCacheEntry like so:

    DeleteUrlCacheEntry(internetCacheEntry.lpszSourceUrlName);
    

    However, in x64 is should be

    DeleteUrlCacheEntry(internetCacheEntry.lpszLocalFileName);
    

    You have to toggle between those based on platform, one single reference does not work on both x64 and x86. Moot point for me, however. This function often throws Access Violation exceptions, and even when caught and handled, I believe that was the root of InternetSetOption performing what seemed as a deadlock. Again, was never able to trouble shoot it thoroughly due to the odd nature of the deadlock, for me to use both that ClearCache() function AND InternetSetOption. Changing the sequence of the two functions calls did not correct it.

    I removed the WebBrowserHelper class and I resorted back to clearing cache and cookies by executing RunDLL32 and waiting for that process to exit.

    Hope that helps someone!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: I have a web application (SnapshotServer) which uses a WebBrowser control to take
I have VB6 application that uses Navigate2 method of WebBrowser control. .Net version of
I have an application which uses Spring 2.5 and Hibernate 3. There's a web
I have an application which uses several levels of class inheritance. I wanted to
I have one application which uses the standard .NET forms authentication cookie, now I
I have a PHP web application which uses a MySQL database for object tagging,
We have an intranet asp.net web application which uses the OOTB ASP.net membership and
I have a problem with an application which uses the same stored procedure over
I have a problem with a little .Net web application which uses the Amazon
Background: I have an application written in native C++ which uses the wxWidgets toolkit's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.