Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Exception handling Approach

Exception handling Approach

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdesigndebuggingbusiness
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amit Kumar G
    wrote on last edited by
    #1

    Hi I am developing an asp.net site with 5 layers as UI, DAO, DTO, Business and DAL. I am confused where should i do exception handling. Do i need to do it on each tier code or just i do it on UI layer.....Please suggest. I am planning to use resource file and log4net. And for all layers except UI, i am planning to maintain trace on log file and on the other hand for UI i will display error on custom error.aspx page and as well as on log file..... Am i correct, as i am doing n tier application first time. Is there any other simpler and full proof way......PLEASE SUGGEST... Amit

    N R 2 Replies Last reply
    0
    • A Amit Kumar G

      Hi I am developing an asp.net site with 5 layers as UI, DAO, DTO, Business and DAL. I am confused where should i do exception handling. Do i need to do it on each tier code or just i do it on UI layer.....Please suggest. I am planning to use resource file and log4net. And for all layers except UI, i am planning to maintain trace on log file and on the other hand for UI i will display error on custom error.aspx page and as well as on log file..... Am i correct, as i am doing n tier application first time. Is there any other simpler and full proof way......PLEASE SUGGEST... Amit

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Amit Kumar G wrote:

      Is there any other simpler and full proof way

      Yeah, don't run the app, that way you will never get any exceptions ;P You should handle the exception in the code where it happens. If it is something that can be corrected, then do so, otherwise rethrow it up the call stack. I'm curious as to why you think you need so many layers? I would suggest using the Enterprise Library Exception Handling Block. It is easy to configure and setup multiple policies for different exceptions and situations.


      only two letters away from being an asset

      A 1 Reply Last reply
      0
      • N Not Active

        Amit Kumar G wrote:

        Is there any other simpler and full proof way

        Yeah, don't run the app, that way you will never get any exceptions ;P You should handle the exception in the code where it happens. If it is something that can be corrected, then do so, otherwise rethrow it up the call stack. I'm curious as to why you think you need so many layers? I would suggest using the Enterprise Library Exception Handling Block. It is easy to configure and setup multiple policies for different exceptions and situations.


        only two letters away from being an asset

        A Offline
        A Offline
        Amit Kumar G
        wrote on last edited by
        #3

        I agree with you, but to buy bread i have to run the application:)) Jokes apart. I appreciate your reply. Can you help me to understand how i can use enterprise library. I have zero idea for this. Cheers Amit

        N 1 Reply Last reply
        0
        • A Amit Kumar G

          I agree with you, but to buy bread i have to run the application:)) Jokes apart. I appreciate your reply. Can you help me to understand how i can use enterprise library. I have zero idea for this. Cheers Amit

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Download it from here http://www.gotdotnet.com/codegallery/codegallery.aspx?id=295a464a-6072-4e25-94e2-91be63527327[^] There are quick starts and examples that should get you going.


          only two letters away from being an asset

          1 Reply Last reply
          0
          • A Amit Kumar G

            Hi I am developing an asp.net site with 5 layers as UI, DAO, DTO, Business and DAL. I am confused where should i do exception handling. Do i need to do it on each tier code or just i do it on UI layer.....Please suggest. I am planning to use resource file and log4net. And for all layers except UI, i am planning to maintain trace on log file and on the other hand for UI i will display error on custom error.aspx page and as well as on log file..... Am i correct, as i am doing n tier application first time. Is there any other simpler and full proof way......PLEASE SUGGEST... Amit

            R Offline
            R Offline
            Ramasubramaniam
            wrote on last edited by
            #5

            Hi, you can use microsoft enterprise library for exception handling and database operations. That will log the exception on the event viewer. Catch the exceptions in all layers, but log the exception only from the UI layer. Throw exceptions from other layers to the UI layer. Istead of using enterprise library, you can log your events and exceptions with datatime on a text file in a specific directory. Those files can be used to keep track of the execution. Ram

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups