Error handling in ASP.NET

30

Transcript of Error handling in ASP.NET

Page 1: Error handling in ASP.NET
Page 2: Error handling in ASP.NET

Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd

Page 3: Error handling in ASP.NET

Week Target Achieved

1 30 23

2 30 26

3 30 25

Typing Speed

Page 4: Error handling in ASP.NET

Jobs Applied

Week Company Designation Applied Date Current Status

1

2

3

Page 5: Error handling in ASP.NET

Error Handling in Asp .net

Muhammed Ajaml

[email protected]

www.facebook.com/ajuik

twitter.com/username

in.linkedin.com/in/profilename

9745020951

Page 6: Error handling in ASP.NET

Exception

• Exceptions are unforeseen errors that happen within

the logic of an application.

– File not found

– Unautherised access

– Argument NullException

– Arithmetic Exception

Page 7: Error handling in ASP.NET

Unhandled exception

• When an exception occurs and if it is not handled.

Page 8: Error handling in ASP.NET

Unhandled exception

• An unhandled exception is displayed to the user using

an”yellow screen of death”

Page 9: Error handling in ASP.NET

Disadvantage of yellow screen of

death. The error messages are cryptic and may not make any

sense to the end user

. The exception information may be useful for a hacker,

to hack into your application

Page 10: Error handling in ASP.NET

Exception handling using - try-

catchTry

{

Wrap the code in a try block that could possibly cause an

exception

}

Catch(Exception e)

{//handle errors}

Finally

{//Used to free resources.}

Page 11: Error handling in ASP.NET

Example

• A program to read data from XML file and display it

to the Grid View

Page 12: Error handling in ASP.NET

Countries.xml

Page 13: Error handling in ASP.NET

Bind to gridview

Page 14: Error handling in ASP.NET

Show Data

Page 15: Error handling in ASP.NET

File not found Exception

Page 16: Error handling in ASP.NET

Error

Page 17: Error handling in ASP.NET

Try –catch-finally

Page 18: Error handling in ASP.NET

Show Error

Page 19: Error handling in ASP.NET

Unauthorised Exception

Page 20: Error handling in ASP.NET

Show Error

Page 21: Error handling in ASP.NET

Asp .net Error Events

• Page_Error

– Used in page level

– This event raised whenever an unhandled exception occurs

in the page.

• Application_Error– Used in application level

– This event raised whenever an unhandled exception occurs

in the application.

Page 22: Error handling in ASP.NET

Page_Error Example

Page 23: Error handling in ASP.NET

Yellow screen death

Page 24: Error handling in ASP.NET

Page_error

Page 25: Error handling in ASP.NET

Errors.aspx

Page 26: Error handling in ASP.NET

Application_Error

• When there is an unhandled exception at an

application level.

• The event handler resides in Global.asax file

Page 27: Error handling in ASP.NET

Contd..

Page 28: Error handling in ASP.NET

Thank You

Page 29: Error handling in ASP.NET

If this presentation helped you, please visit our page facebook.com/baabtra and like it.

Thanks in advance.

www.baabtra.com | www.massbaab.com |www.baabte.com

Page 30: Error handling in ASP.NET

Contact Us

Emarald Mall (Big Bazar Building)Mavoor Road, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

NC Complex, Near Bus StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

Start up VillageEranakulam,Kerala, India.

Email: [email protected]

IKK Road,East Hill, KozhikodeKerala, India.Ph: + 91 – 495 30 63 624

NIT-TBI,NIT Campus, Kozhikode,Kerala, India.