[ C# ] create web project 101

New Project

In visual studio, File > New Project

`Visual C# Projects` and in the Templates pane, select `ASP.NET Web Application`.

The source will be generated,

About.aspx           #
About.aspx.cs
About.aspx.designer.cs
Account\ChangePassword.aspx
Account\ChangePassword.aspx.cs
Account\ChangePassword.aspx.designer.cs
Account\ChangePasswordSuccess.aspx
Account\ChangePasswordSuccess.aspx.cs
Account\ChangePasswordSuccess.aspx.designer.cs
Account\Login.aspx                     #
Account\Login.aspx.cs
Account\Login.aspx.designer.cs
Account\Register.aspx                #
Account\Register.aspx.cs
Account\Register.aspx.designer.cs
Account\Web.config
App_Data
bin
Default.aspx                          #
Default.aspx.cs
Default.aspx.designer.cs
Global.asax
Global.asax.cs
obj\Debug
obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
obj\Debug\TempPE
Properties\AssemblyInfo.cs
Scripts\jquery-1.4.1-vsdoc.js
Scripts\jquery-1.4.1.js
Scripts\jquery-1.4.1.min.js
SFA.csproj
SFA.csproj.user
Site.Master
Site.Master.cs
Site.Master.designer.cs
Styles\Site.css
Web.config
Web.Debug.config
Web.Release.config

Build and Deploy

In Solution Manager, Right Click at the project > Build

In Solution Manager, Right Click at the project > View in Browser

Add New Page

right click project > Add > New Item

.. Web Form

The files will be generated.

PongTest.aspx – the visual representation
PongTest.aspx.cs or PongTest.aspx.vb – Code for event handling

PongTest.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PongTest.aspx.cs" Inherits="SFA.PongTest" %>

<!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">
<div>

</div>
</form>
</body>
</html>

 PongTest.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SFA
{
public partial class PongTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
}

ref : microsoft