|
Bangladeshi Softwares
|
| Home - Download - Codes & Tutorials - Bangla IT Bibhag - Mobile - About Me |
Running CGI scripts written in C with IIS
Step-1:
In this tutorial, I will try to show you running a CGI script written in C with Microsoft Internet Information Server. Open a text editor and enter the code below:
/*
* Author: Ahsanul Haque Shovon
* Email: ahsanul.haque.shovon@gmail.com / ahsanul_haque_shovon@yahoo.com
* Web: http://shovon.110mb.com
*/
#include <stdio.h>
int main()
{
printf("Content-Type: text/html\n\n");
printf("<html><head>");
printf("<title>CGI in C!</title>");
printf("</head>");
printf("<body bgcolor="\silver\" text=\"navy\">");
printf("<h1>CGI in C!</h1>");
printf("<hr>");
printf("Hi, I'm a CGI script written in C.");
printf("</body></html>");
return 0;
}
Step-2:
Save the file with whatever_name.c and compile it with a C/C++ compiler (e.g. MS VC++, Dev-C++, Borland C++ etc). See a screenshot below:
Now find the whatever_name.exe and rename it whatever_name.cgi (it also works fine with the *.exe extension though). Open the Internet Information Services snap-in and create a vitual directory with whatever_name. See a screenshot below:
Set its permission to Read, Run scripts (such as ASP), Execute (such as ISAPI applications or CGI). Click on Next and then Finish. See a screenshot below:
Open your web browser and browse http://localhost/whatever_name/whatever_name.cgi. You should get the output shown below:
You should rename whatever_name with your desired name.
Other Helpful Resources:
http://hoohoo.ncsa.uiuc.edu/cgi
http://www.boutell.com/cgic
|
©Ahsanul Haque Shovon
All rights reserved
|