Platform: Windows XP and 98
Language: C#
Explanation
We have an in-house call center application that uses the axweb browser control to house various web sites, both internal and external. The problem is intermittent but in some cases we see the first page with the previous customer's information. I have issued commands to clear and abandon sessions, and then change the browser's focus so the commands can take effect.
More specific, this only occurs when we have an internal web site that links to an external client site and then back. Coming back to our site is achieved by looking for a trigger, on the client site, of unique form name and textbox combination. Once this is found in the event handler DocumentComplete, the browser will shift focus to an internal web page for call processing and session clean up. It seems the last page navigation never occurs about 2% - 5% of the time.
Ideally, I would like to figure why this last section is sometimes not executed. Due to deadlines, I will accept a way to force sessions to clear from the browser code (Windows Forms) and not the web project's code. I hope the code provided is enough or a good start.
Thanks in advance
Code
private void axweb_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{[indent]ProcessExternalCampaign(e);
}
===============================================
private void ProcessExternalCampaign(AxSHDocVw.DWebBrowserEvent s2_DocumentCompleteEvent e)
{
object formresult = doc2.all.item("_DialerSubmit",null);
//The external script has reached the end and agent/verifier has dipositioned
if(formresult != null)
{
object CurrentCallResult = null;
CurrentCallResult = doc2.all.item("CurrentCallResult",null);
if(CurrentCallResult != null)
{
string sCallResult = ((HTMLInputElementClass)CurrentCallResult).value;
ExternalNavigationClick(ExternalButtonType.Save, "?ExternalDispoCode=" + sCallResult);
}
}
}
================================================
private string ExternalNavigationClick(ExternalButtonType buttonType)
{
ExternalCampaignInfo ec = ((frmMain)Owner).oExternCampaignManager.GetCampaig n(((frmMain)Owner).QueueToLaunchScript);
if(!ec.Registered || !ec.HasButtons) return "";
for(int i=0; i < ec.NavigationButtons.Length; ++i)
{
if(ec.NavigationButtons[i].ButtonType == buttonType)
{
axweb.Navigate(ec.NavigationButtons[i].TargetUrl);
return ec.NavigationButtons[i].TargetUrl;
}
}
return "";
}