How to call an url from BHO (as an AJAX call) in the current browser RRS feed

  • Question

  • Hello guys,

    I have my C# BHO Toolbar well working now, but,

    I don't find the way to call the url http://www.mywebsite.com/index.php?action=logout to logout from my website.

    I can do it by navigating to it with Explorer.Navigate2(url) but i don't want to reload the page, i would prefer to call the url like an ajax call.

    I tried the following :



       HttpWebRequest MyRequest = (HttpWebRequest)WebRequest.Create("http://www.mywebsite.com/index.php?action=logout");
       MyRequest.Method = "GET";
       MyRequest.Accept = "text/html";
       MyRequest.Timeout = 3000;
       // Prepare web request and send the data.
       HttpWebResponse MyResponse = (HttpWebResponse)MyRequest.GetResponse();
       Stream streamResponse = MyResponse.GetResponseStream();
       // And read it out
       StreamReader reader = new StreamReader( streamResponse );
       string response = reader.ReadToEnd( );


    But it doesn't log me from the website, cause it's not directly the webbrowser which call the url. So the cookie isn't destroyed.

    How can i do this?

    Thank you in advance ! :)

    Wednesday, March 30, 2011 1:25 PM


  • I think you want to call IHTMLWindow5::get_XMLHttpRequest and then use the object that returns to make your request.  Could be wrong though... not sure how that handles cookies.  You may have to manually go find the cookies you want and manually add them to the request.  TAANSTAFL.
    • Marked as answer by Yi Feng Li Tuesday, April 12, 2011 2:49 PM
    Thursday, March 31, 2011 3:08 PM