in reply to Open another IE browser window from CGI

Since you are running this script under IIS, you only have the permissions that the IIS process has. CGI apps on IIS run using the IUSR_MachineName account, and have very limited rights. I believe that is why you aren't getting the results you expect.

Try changing account used for Anonymous IIS access. Go to Start->Run and type inetmgr and hit enter. This will bring up the management console for IIS. Right click on the web site and select Properties, the go to the Directory Security tab. Change the account used for anonymous access to your user account, then try running your script.

If this is for an intranet, and everyone will have a domain account, you could also enable Integrated Authentication.

As everyone else has stated, this will not launch a browser on a separate client machine, but will work if, as you say, client and server are the same box.

Tested on IIS5/WinXP/ActiveState Perl 5.8/IE8

  • Comment on Re: Open another IE browser window from CGI

Replies are listed 'Best First'.
Re^2: Open another IE browser window from CGI
by Olaf (Acolyte) on Jan 24, 2008 at 19:58 UTC
    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!

      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!