Blog

Find Our experience, Knowledge and Solutions

Judah Web Solutions,Sivakasi

want to know about ASP.NET

What is ASP?

ASP stands for Active Server Pages. Also called Classic ASP is the first server-side scripting language introduced by Microsoft in the year 1998.

What is ASP.NET?

This is an open-source server-side web application framework developed by Microsoft

that was released in the year 2002 as a successor of a Classic ASP. ASP.Net is used to produce dynamic web pages and allow programmers to build dynamic websites, web applications, and web services. ASP.Net is built on Common Language Runtime that allows the programmers to use full-featured programming languages such as C# and VB.Net to build the web application easily. ASP.Net supports different development models such as ASP.NET web forms, web pages, MVC, API, and Core.

What is ASP.NET Web Forms?

ASP.Net WebForms is a framework for building modular pages and an event-driven application model.

What is ASP.NET Web Pages?

ASP.Net Web Pages is a Single Page Application that is quite similar to Classic ASP and merged with ASP.Net Core. ASP.Net web pages have a lightweight syntax for adding dynamic code and access the data directly inside the HTML.

What is ASP.NET MVC?

ASP.Net MVC allows building web applications using the Model-View-Controller design pattern and merged with ASP.NET Core.

What is ASP.NET API?

ASP.Net API is a framework for building web APIs using the Application Programming Interface.

what is ASP.Net Core?

ASP.Net Core merges all the above things used to build web applications in one application framework.

Exception or Error Handling in ASP.NET

It is very important for programmers to understand the errors and handling errors and exceptions. Implement the error handling techniques are used to

avoid breaking the pages.

For example,

Show the offers of the products from a web page

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

string constr = ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString;

string selstr= "Select * From tblprdoffers";

SqlConnection con = new SqlConnection(constr);

SqlCommand cmd = new SqlCommand(selectSQL, con);

SqlDataAdapter adap = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

adapter.Fill(ds, "Product Offers");

GridView1.DataSource = ds;

GridView1.DataBind();

}

}

string selstr= "Select from tblprdffers"

When the table name is changed as follows,

string str= "Select from tblproducts"

or the mentioned table is not in the database "Invalid Object Name" error has been occurred.

This error has been handled using Try catch finally block.

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

try

{

string constr = ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString;

string sdata = "Select * From tbloffers";

SqlConnection con = new SqlConnection(constr);

SqlCommand cmd = new SqlCommand(selectSQL, con);

SqlDataAdapter adap = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

adapter.Fill(ds, "Product Offers");

GridView1.DataSource = ds;

GridView1.DataBind();

}

catch (Exception e) { Labelerr.Text = "Please check"}

finally{}

}

}

and for page-level error, can use

Response. Redirect "Errorpage.aspx")

Likewise, many ways are there to handle errors and exceptions in ASP.Net.