Saturday, June 28, 2008

How can you access Running instance of IE and refersh page

First you need to refer SHDocVw.dll and MSHTML.dll. In Visual Studio, go to Project, Add Reference, and then select the COM tab. select these dlls.

Csharp Code:

string myUrl = www.google.com;
SHDocVw.WebBrowser m_browser = null;
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
string filename;
foreach (SHDocVw.WebBrowser ie in shellWindows)
{
filename = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
if (filename.Equals("iexplore"))
{
m_browser = ie;
//Assign Browser Document
mshtml.IHTMLDocument2 myDoc = (mshtml.IHTMLDocument2)m_browser.Document;
//URL Location
string myLocalLink = myDoc.url;
if (myLocalLink == myUrl)
m_browser.Refresh();
//break;
}

You also can do other actions using m_browser, m_browser.Document to control content ofthis page.

Monday, June 2, 2008

How to resolve the RUP error: Applet RupPresenterApplet notinited

Problem
When publishing the RUP template from IBM® Rational Unified Process builder to IIS Web server on Windows 2003, the published site works when accessing it directly but does not work when it is accessed through the web server. The tree browser on the left hand side of the site gives the error: Applet RupPresenterApplet notinited.

Cause
IIS cannot serve some of the RUP files with special file extensions like .properties, .cfg, .layout, etc. (See below for more info.). Because of this reason the applet cannot download and initialise itself correctly.

Solution
The solution to this problem is to re-configure IIS to add more mime types, shown as follows:
1. Go to Administrative Tools -> IIS Manager, right click the site and bring up the properties dialog box as below:
2. Go to the HTTP Headers tab, and click on MIME Types... button to the following dialog box.
3. Click on the New... button to bring up repeatedly the following MIME Type dialog box and add five extension/MIME type pairs shown in the above list.
4. Close these dialog boxes and apply the changes.
5. Restart the IIS server.
6. Close all sessions of browsers and reopen a new browser to load the RUP.