There's no real way to make a "fair comparison" as the two really are like "chalk and cheese". A desktop application has one "entry point", running the executable whereas a web application has many, each .aspx page that you've created.
There's no "easy" way to convert a "Hello World" application as the UI/presentation models are so completley different. A classic console application is entirely written in code using Console.WriteLine
, whereas a webforms application that says "Hello World" can be written entirely in asp.net markup.
An asp.net "Hello World" application can be as simple as a file called default.aspx containing:
<%@ Page Language="C#" AutoEventWireup="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
Hello, world!
</form>
</body>
</html>
Whereas the console/desktop application equivalent is:
using System;
namespace ConsoleHelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.Write("Hello World");
}
}
}