in reply to Re: Open another IE browser window from CGI
in thread Open another IE browser window from CGI

This certainly seemed promising, but no dice. I will look into other permission settings though just in case. I'm not much of an IIS whiz.
Do you believe in miracles? Yes!
  • Comment on Re^2: Open another IE browser window from CGI

Replies are listed 'Best First'.
Re^3: Open another IE browser window from CGI
by digger (Friar) on Jan 24, 2008 at 21:08 UTC

    First, you may have to give the user account the "Act as part of the operating system" right in the Local Security Settings snap-in. The Group Policy on the computer I am using right now doesn't allow me to test this, but the account I used has that right, and the error I received when using an account that didn't have that right seems to point at this issue.

    Second, you can get the error message from any Win32 calls pretty easily. Those messages are invaluable in tracking down solutions to problems like this. Often the message itself is worthless, but Googling it will give good answers. Here is the code I used to print the error message to the browser.

    use Win32::OLE; use Win32; use CGI; my $q = new CGI; print $q->header; my $browser = new Win32::OLE 'InternetExplorer.Application'; print Win32::FormatMessage( Win32::GetLastError() ); $browser->Navigate("http://www.apple.com", 0, 'xyzzy');

    If you run the above code using an account that doesn't have the "act as operating system" right, you should get the error "An attempt was made to reference a token that does not exist."

    Good Luck,
    digger

      First, thanks digger for pointing me in the right direction. I think this is an IIS issue so I will take it elsewhere and return the solution here if I find it.

      That being said, I can't get an error to show. I have:

      use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Win32::OLE qw(in with); use Win32; my $browser = Win32::OLE->new("InternetExplorer.Application"); $browser->{visible}=1; $browser->Navigate($SelectedAppURL) || die("IE Not Started:", Win32::FormatMessage(Win32::GetLastError +())); #|| die("IE Not Started:",Win32::FormatMessage(Win32::OLE::Las +tError()));

      The code does die on the Navigate line, but the results from both GetLastError and LastError are 'The Operation Completed Successfully'. Carp doesn't return anything of value besides 'Software error'. And if the die() is not in the code, no error is returned.

      And as a point of interest on the Windows - IIS side, I've tried:
    • Giving full security permission to Administrator, IUSER to the iexplorer.exe folder and the folder containg the cgi files
    • Gave rights in IIS
    • Changed IIS Anonymous Access to Administrator
    • Set local accounts to 'act as part of the OS'
    • Change the IIS login
    • Do you believe in miracles? Yes!