Error Handling Strategy In Asp.net
Websites Community Support ASP.NET Community Standup ForumsHelp Web Forms:Guidance Videos Samples Forum Books Open Source Getting Started Getting StartedGetting Started with ASP.NET 4.5 Web Forms and Visual Studio 20131. Getting Started with Web Forms and Visual Studio2. Create the Project3. Create the Data Access Layer4. UI and Navigation5. Display Data Items and Details6. Shopping Cart7. Checkout and Payment with PayPal8. Membership and Administration9. URL Routing10. ASP.NET Error HandlingIntroduction to ASP.NET Web FormsCreating a Basic Web Forms Page in Visual Studio 2013Creating ASP.NET Web Projects in Visual Studio 2013Code Editing ASP.NET Web Forms in Visual Studio 2013ASP.NET Scaffolding in Visual Studio 2013ASP.NET Web Forms (dotnetConf 2014)Using Page Inspector for Visual Studio 2012 in ASP.NET Web FormsVisual Studio 2012 Hands On LabsWhat's New in ASP.NET and Web Development in Visual Studio 2012What's New in Web Forms in ASP.NET 4.5Using Page Inspector in Visual Studio 2012Monitoring and TelemetryRoutingASP.NET 4 - RoutingASP.NET 4 - Defining RoutesASP.NET 4 - Constructing URLs from RoutesASP.NET 4 - Accessing URL Parameters in a PageJavaScript and Client FrameworksASP.NET 4 - Microsoft Ajax OverviewASP.NET AJAX Control Toolkit (maintained by DevExpress)Working with Data Getting Started with ASP.NET 4.5 Web FormsModel Binding and Web Forms in Visual Studio 20131. Retrieving and Displaying Data2. Updating, Deleting, and Creating Data3. Sorting, Paging, and Filtering Data4. Integrating JQuery UI Datepicker5. Using Query String Values to Filter Data6. Adding Business Logic LayerASP.NET 4 Web Forms - Validating User Input in a PageASP.NET 4 Web Forms - State ManagementASP.NET Data Access - Recommended ResourcesServer Data ControlsASP.NET 4 Data-Bound ControlsASP.NET 4 Data Source Controls OverviewASP.NET 4.5 Chart ControlRecommended Resources for ASP.NET Data AccessSecurity, Authentication, and Authorization Getting Started with ASP.NET 4.5 Web FormsASP.NET IdentityCreate a secure ASP.NET Web Forms app with user registration, email confirmation and password reset (C#)Create an ASP.NET Web Forms app with SMS Two-Factor Authentication (C#)OWIN and KatanaPerformanceUsing Asynchronous Methods in ASP.NET 4.5[Build 2014] Deep Dive: Improving Performance in Your ASP.NET App (Levi Broderick)ASP.NET 4 - Web Forms Perform
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up General Exception Handling Strategy for .NET up vote 12 down vote favorite 5 https://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/aspnet-error-handling I’m used to having try/catch blocks in every method. The reason for this is so that I can catch every exception at the point of infraction and log it. I understand, from my reading and conversations with others, that this isn’t a popular view. One should only catch what one is prepared to handle. However, if I don’t catch at the point of infraction, then it would be possible to http://stackoverflow.com/questions/1050282/general-exception-handling-strategy-for-net never log that infraction and know about it. Note: When I do catch and don’t handle, I still throw. This allows me to let the exception propagate to something that will handle it, yet still let me log it at the point of infraction. So... How does one avoid try/catch in every method, yet still log the error at the point at which it occurred? c# .net exception-handling exception-logging share|improve this question edited Jun 26 '09 at 18:11 John Saunders 138k20175321 asked Jun 26 '09 at 17:32 Bob Horn 14.2k1264133 3 What language? Different languages have different ways of dealing with the traceback from point of catch to point where it was thrown. –S.Lott Jun 26 '09 at 17:35 The language is C#. –Bob Horn Jun 26 '09 at 17:45 WHat drives your need to log at the infraction point? if you log the call stack included in the exception you would still be able to se in the log what was going on and what route your code took to end up at that point –Rune FS Jun 26 '09 at 18:22 There were two reasons for logging at the infraction point. One, the method could send objects
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with http://stackoverflow.com/questions/566358/error-handling-logging-strategy us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error handling/Logging strategy up vote 7 down vote favorite 5 Could you guys share your knowledge about Error handling/Logging strategy for asp.net 3.5 web based application? c# asp.net design share|improve this question edited Feb 19 '09 at 17:40 GEOCHET 16.4k156085 asked error handling Feb 19 '09 at 17:36 Jeremy Thomson 40431117 add a comment| 4 Answers 4 active oldest votes up vote 15 down vote Log4net logging: What have you found to be useful? What are the best practices to log an error? Logging Best Practices What To Write Into Log File? What should be included in the state of the art error and exception handling strategies? What information should I be logging in my web app? Logging is a very critical part of every application, so error handling strategy it is important that you do it well. share|improve this answer answered Jul 3 '09 at 17:09 DevinB 6,43253348 add a comment| Did you find this question interesting? Try our newsletter Sign up for our newsletter and get our top new questions delivered to your inbox (see an example). Subscribed! Success! Please click the link in the confirmation email to activate your subscription. up vote 2 down vote You should consider log4net. See this question for more information. It is very robust, fast, and easy to use. share|improve this answer answered Feb 19 '09 at 17:39 Geoff 8,00652746 add a comment| up vote 2 down vote When an error occurs you should not attempt to catch it or log it directly in your application's code unless it is an error you can hope to recover from. For example, if you have a data-driven web application and the database is offline, that is not something you can recover from. But if you are sending an email and have two email servers and the first one is down, you might be able to recover by using the second email server. I've seen many ASP.NET applications where developers have used try...catch blocks to "swallow" errors. In reality, try...catch blocks only be used when there is a known recover strategy in the event of an error (such as using an alternate email server in my earlier example). If you have more than a handful of try...catch blocks in your application you're probably do