Errors In ASP

Tips >> ASP

There are various types of Errors it can be explained as follows. If we catch errors with coding can make the programmers' and the users' life a little easier and a lot less graying hair. If you are from a VB6 background; well throw out the ideas of using On Error Goto or Resume Next-those things DO NOT EXIST in C#-land. So lets get to the areas of catching errors with ASP.net and C#.

The Objectives of the Errors :-
Responding to Clients and Errors in ASP.NET

  • Select the steps to enable a control to post back data to the server.
  • Use the request and response objects to intercept communication between a client and the server.
  • Enable an ASP.NET page to handle client actions.
  • Configure an ASP.NET application to catch exceptions and errors.
  • Handle errors that occur in a web application.


There are following Types of Errors :-

  • Logical :- It could be a math error (i.e. division by zero); mismatches (i.e. adding a string to a number); bad data output (i.e. allowing invalid time/date on the output) and there are others as well.
  • System :- These can be ASP.net or CLR parser error based on the something that it doesn't like about the code it is trying to process. But it could be a memory low on the server or the server got unplugged.

The following is the Syntax of the Errors :-

This is a basic typos or the improper closing of tags.

Example#1 :-

<html>

<head>

<title>Error 1</title>

</head>

<body>

<center>ErrorsRUs</center>

<asp:lbel id="Error" runat="server" text="Ooops…" />

</body>

</html>

The above stated are some common and silly error; we are typing quickly or forget to close attributes or add spaces to them.

Example#2 :-

<script language="c#" runat="Server">
void WholePositveNumber(object sender, EventArgs e)
{
if (txtNumber.Text != "")
{
if (!(Char.IsNumber(txtNumber.Text, 0)))
{
if (txtNumber.Text.Substring(0,1) != "-")
{
lblEntered.Text = "Please enter only positive numbers.";
}
else
{
lblEntered.Text = "Please enter number of the positive nature.";
}
}
else if (Convert.ToInt32(txtNumber.Text) == 0)
{
lblEntered.Text = "Please enter a number greater then 0.";
}
else if (Convert.ToInt32(txtNumber.Text) > 0)
{
lblEntered.Text = "Thank you for entering a positive real number.";
}
}
else
{
lblEntered.Text = "Please provide a number.";
}
}
</script>
<html>
<head>
<title> Trapping error a la Manual Style</style>
</head>
<body>
<form method="post" action="PostiveNumbers.aspx" runat="server" ID="Form1">
<asp:Label text="Enter:" runat="server" />
<asp:Textbox id="txtNumber" runat="server" />
<hr />
<asp:Button id="btnEntered" Text="Enter"
onclick="PositiveNumber" runat="server" />
<br />
<asp:Label id="lblEntered" runat="server" />
</form>
</body>
</html>

The above stated errors are the programmers errors which proggrammers faced.

The Errors can further be classified as :-

  • Active Server Pages error 'ASP 0126' :-You will get Active Server Pages error ´ASP 0126´ if you try to include a file that does not exist. This is a straightforward error - that file is not on your server!
  • Active Server Pages error 'ASP 0131' :-Active Server Pages error ´ASP 0131´ means your server doesn´t support reference to upper folder.
  • ActiveX component can't create object: 'CDONTS.NewMail' :- Sending mail in ASP is one of the most basic tasks to accomplish. What happens when you get the error ActiveX component can´t create object: ´CDONTS.NewMail´?
  • Array Subscript Overflow Error :- If you´re using arrays, it´s very likely at one point or another that you´ll hit a subscript overflow error.
  • ASP Error - Overflow: 'cInt' :- A common error in ASP is the Overflow: ´cInt´ error. What does it mean when you overflow a cInt value? How do you fix this?
  • ASP Error - The HTTP Headers are already written :- A very common error in the world of ASP is: The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
  • ASP Error The requested resource is in use :- The following error - The requested resource is in use - is caused in ASP by the ISAPI caching setting in IIS.
  • Server Too Busy - Error 500-13 :- If your website keeps growing and growing, eventually you will hit the error 500-13, that your server is too busy to handle the requests. What do you do?
  • The requested resource is in use :- The error "The requested resource is in use" is fairly common in Windows. If you´re getting this with ASP calls, it usually means something is not up to date.
  • Type Mismatch Error :- Type mismatch is a general error that happens when you try to stuff one type of value into a variable of another type.

 

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641