Live Chat Icon For mobile
Live Chat Icon

Can I write CGI applications using .NET

Platform: WinForms| Category: CGI

You sure can. Here is a simple CGI program that prints out the current time and also all the environment variables that are available to it.

using System;

public class cgi
	public static void Main(string[] args)
		if(args.GetLength(0) == 0)
			Console.WriteLine('The time now is {0}', System.DateTime.Now.ToString());
			Console.WriteLine('Hi {0}, the time now is {1}', args[0], System.DateTime.Now.ToString());
		foreach(string s in Environment.GetEnvironmentVariables().Keys)
{0} : {1}
',s, Environment.GetEnvironmentVariables()[s]);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.