kluivats

kluivats

  • NA
  • 13
  • 0

Invoking a widnows forms application from another application (windows service)

Sep 5 2007 4:33 AM
I have 2 C# applications. One web form application with web browser control to navigate to a site, fill up the fields, and submit.

This application is invoked in another c# application (with no ui, a windows service), using the Process()

ProcessStartInfo oInfo = new ProcessStartInfo(sFilePath, sArgs);
oInfo.UseShellExecute = false;
oInfo.RedirectStandardOutput = true;
oInfo.RedirectStandardError = true;
oInfo.RedirectStandardInput = true;
m_oProc.StartInfo = oInfo;
m_oProc.Start();

The windows form application works fine when invoked individually. But when this is called using the process() it always return "Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable"

The arguments passed to the invoked application are properly received and processed. But only the AxWebBrowser1.Navigate(url, ....) is not functioning properly.


<TABLE cellSpacing=5 cellPadding=3 width=400>
<TBODY>
<TR>
<TD id=tableProps vAlign=top align=left><IMG id=pagerrorImg height=33 src="pagerror.gif" width=25></TD>
<TD id=tablePropsWidth vAlign=center align=left width=360>
<H1 id=errorText style="FONT: 13pt/15pt verdana; COLOR: black">Action canceled</H1></TD></TR>
<TR>
<TD id=tablePropsWidth width=400 colSpan=2><FONT style="FONT: 8pt/11pt verdana; COLOR: black">Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.</FONT></TD></TR>
<TR>
<TD id=tablePropsWidth width=400 colSpan=2><FONT id=LID1 style="FONT: 8pt/11pt verdana; COLOR: black">
<HR color=#c0c0c0 noShade>

<P id=LID2>Please try the following:</P>
<UL>
<LI id=instructionsText2>Click the <A target=_self xhref="javascript:location.reload()"><IMG height=16 alt="refresh.gif (82 bytes)" src="refresh.gif" width=13 align=middle border=0></A> <A target=_self xhref="javascript:location.reload()">Refresh</A> button, or try again later.<BR>
<LI id=instructionsText3>If you have visited this page previously and you want to view what has been stored on your computer, click <B>File</B>, and then click <B>Work Offline</B>.<BR>
<LI id=instructionsText4>For information about offline browsing with Internet Explorer, click the <B>Help</B> menu, and then click <B>Contents and Index</B>.<BR></LI></UL>
<P><BR></P>
<H2 id=ietext style="FONT: 8pt/11pt verdana; COLOR: black">Internet Explorer </H2></FONT></TD></TR></TBODY></TABLE>

Note: Due to some issues with the site I am accessing, I have to move away from using HttpWebRequest and do it as a separate web form application.

Regards
Kluivats