[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

CGI configuration for NT and IIS

Ok, I'm kind of new to CGI, and am having some trouble getting started, not because of any difficulty with the CGI programming itself, but because of my server.

I have a server running NT 4.0 Server SP 3 and IIS 3... Anyway, here is the problem, and what I've tried so far.
I created and compiled a very simple program in C. It does nothing more than display an html header and a single string. Just a simple test program basically.

I created a cgi-bin directory under the default wwwroot directory of the server, and granted Read/Execute permission to everyone. I then created a simple HTML file as follows:

begin file -------
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (WinNT; I) [Netscape]">
   <TITLE>My CGI Test Bed</TITLE>
</HEAD>
<BODY>

<H1>
My CGI Test Bed</H1>
<FORM METHOD="POST" ACTION="/cgi-bin/test.exe?test=0">Press&nbsp;<INPUT TYPE="submit" VALUE="Here">
to run the program.&nbsp;</FORM>
</BODY>
</HTML>
end file ----------

I placed this html file in the same directory as my personal web page, because I know that directory works...
When I access this file, it comes up fine, and displays the button as it should. However, when I press the button that SHOULD call the cgi program immediately, the server requests a username and password. Nothing works, I've even tried the Administrator password, it doesn't care. The permissions on the directory are set to RX for everyone and IIS has permissions set the same. If I move the cgi program to my personal directory, where the .html file is also stored, I have the same problem. It wants a login. Does anyone know what I need to change to get IIS to execute this program properly? Do I need to change the .exe extension to something else, or what?
0
wrussell051197
Asked:
wrussell051197
  • 3
  • 3
1 Solution
 
sybeCommented:
When you have created a cgi-bin directory, you should go into IIS, make it a virtual directory and make it executable, this makes IIS treat that directory as a cgi-bin directory, no matter what the name is.

Use the IIS manager to do this.

0
 
wrussell051197Author Commented:
I have done this already. The virtual directory is named cgi, permissions are set as follows:

Access Permissions:
     Read
     Log Access
Content Control
     Index this Directory
Aplication Settings:
     Execute (including script)
     Starting Point: <Default Web Site>/cgi

it still doesn't work.
0
 
alamoCommented:
One possible problem is that even though your program is simple, it still might require DLLs to run, and those DLLs can't be located in directories which require access permissions the server doesn't have (the sytem32 directory, for example). Try moving your support DLLs to the same directory as your executable.

This is the most common cause of such problems, though the fact your administrator password didn't at least allow you to run your program make me wonder if there isn't something else happening also. But definitely worth checking. Good luck!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
wrussell051197Author Commented:
What DLLs would be required to run a very simple program. The only statements in it are printfs. Here's the code:

begin file ----------------------
#include <stdio.h>

main(int argc, char **argv) {
  printf("Content-type: text/html\n\n");

  printf("<HTML><HEAD><TITLE>Hello!</TITLE></HEAD>\n");

  printf("<BODY><H1>Hello, World!</H></BODY></HTML>\n");
}
end file -----------------------

I mean, there's not much there to require a DLL...
0
 
alamoCommented:
I don't know what DLLs are needed, since I don't know which compiler you are using. But to find out, right click on your .exe in explorer or My Computer and choose "Quick View". The "import table" shows which DLLs are required. User32, Kernel32, gdi32 are all Windows system DLLs and aren't subject to the security, others which are listed would be.

By the way... this .exe needs to be 32-bit, 16-bit won't work.
0
 
wrussell051197Author Commented:
By the way, this idiot had his compiler set to 16-bit DOS mode :) A quick change to 32-bit Win32 mode and everything worked great :)

Thanks again :)
0
 
alamoCommented:
Great, glad it's working for you! :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now