Skip Navigation LinksASP.Net 2.0 Training : ASP.Net:Error Handling
Banner for ASP.Net 2.0 training classes in Visual Basic 2005 

Skip Navigation Links
ASP.Net 2.0 Training
VS File Management
ASP.Net Image
ASP.Net Checkbox
ASP.Net ImageButton
ASP.Net RadioButton
ASP.Net Literal
ASP.Net Panel
ASP.Net LinkButton
ASP.Net Calendar
ASP.Net BulletedList
ASP.Net FileUpload
ASP.Net User Controls
ASP.Net PlaceHolder
ASP.Net Lists
ASP.Net CheckBoxList
ASP.Net DropDownList
ASP.Net Data Access
ASP.Net DetailsView
ASP.Net FormView
ASP.Net Repeater Control
ASP.Net:Master Pages
Sending EMail
MultiView
Tabbed MultiView
ASP.Net:Wizard Control
Login Controls 1
ASP.Net:Site Navigation
ASP.Net:Classes
ASP.Net:SQLDataSource Control
ASP.Net:Error Handling
ASP.Net:dataTables
ASP.Net:datasets

Visit my other site:

Free Flash 8 tutorials and training

Free Dreamweaver Video Tutorials

Free PHP Training

Visual Basic Windows Training




If you like this site please link to it


Error Handling
Try Catch Blocks


Open your web.config file
Set debug to true in web.config

  • Add a new webform
  • Type Generate an exception
  • Add a button
  • Double-click the button and add this code:

Dim test as string=nothing
Response.write(test.toString( ) )

This will cause an exception

  • Test it


Add try catch around it

Try
Dim test as string=nothing
Response.write(test.toString( ) )
Catch ex as exception
Response.write(string.concat(“An error occurred”,ex.message)
End try

Generates a generic exception

Modify it:
Try
Dim test as string=nothing
Response.write(test.toString( ) )
Catch nex as nullreferenceexception
          Response.write(string.concat(“The variable was not initialized”))

Catch ex as exception
Response.write(string.concat(“An error occurred”,ex.message)
End try

 

Exception handling stops trying to catch once an exception is handled

Put specific handlers first
Put generic handlers last


      ASP.Net 2.0 tutorials & training