Asp.Net Syntax Asp.Net Syntax that How to Write C# code in .aspx page so first of all you need to create a website understand Asp.Net Syntax so let's get's started. Asp.Net Syntax You Can type c# code in asp.net using <% %> then you will be able to write c#. Default.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <% Response.Write("My First Web Page"); %> </div> </form> </body> </html> Output : Run in Browser My First Web Page Create Simple Add <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <% int a, b,c; a = 5; b = 9; c = a + b; Response.Write(c); %> </div> </form> </body> </html>