Error handling in ASP.NET

274 views
213 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
274
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Error handling in ASP.NET

  1. 1. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  2. 2. Week Target Achieved 1 30 23 2 30 26 3 30 25 Typing Speed
  3. 3. Jobs Applied Week Company Designation Applied Date Current Status 1 2 3
  4. 4. Error Handling in Asp .net MuhammedAjaml mhdajmalik@gmail.com www.facebook.com/ajuik twitter.com/username in.linkedin.com/in/profilename 9745020951
  5. 5. Exception • Exceptions are unforeseen errors that happen within the logic of an application. – File not found – Unautherised access – Argument NullException – Arithmetic Exception
  6. 6. Unhandled exception • When an exception occurs and if it is not handled.
  7. 7. Unhandled exception • An unhandled exception is displayed to the user using an”yellow screen of death”
  8. 8. 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
  9. 9. Exception handling using - try- catch Try { Wrap the code in a try block that could possibly cause an exception } Catch(Exception e) {//handle errors} Finally {//Used to free resources.}
  10. 10. Example • A program to read data from XML file and display it to the Grid View
  11. 11. Countries.xml
  12. 12. Bind to gridview
  13. 13. Show Data
  14. 14. File not found Exception
  15. 15. Error
  16. 16. Try –catch-finally
  17. 17. Show Error
  18. 18. Unauthorised Exception
  19. 19. Show Error
  20. 20. 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.
  21. 21. Page_Error Example
  22. 22. Yellow screen death
  23. 23. Page_error
  24. 24. Errors.aspx
  25. 25. Application_Error • When there is an unhandled exception at an application level. • The event handler resides in Global.asax file
  26. 26. Contd..
  27. 27. Thank You
  28. 28. 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
  29. 29. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com IKK Road, East Hill, Kozhikode Kerala, India. Ph: + 91 – 495 30 63 624 NIT-TBI, NIT Campus, Kozhikode, Kerala, India.

×