Software Development Kit
EasyErrorHandler Class
MicroMighty.SDK.Web.Tools Namespace
Usage
This class should be used in the "Application_Error" event of "Global.asax" in order to process errors,
A reference to the SDK DLLs is required, see how to add a reference to the MicroMighty SDK DLLs.
Configuration
Web.Config should include the following variables in order for this class to run correctly,
If no variables added then the module will not run and EasyErrorHandlerActive will be set to "false".
Add the following entries in the "<appSettings>" section of "<configuration>"
<!-- MicroMighty SDK : EasyErrorHandler Variables -->
<add key="EasyErrorHandlerActive" value="true
" />
<add key="EasyErrorHandlerIgnoreInvalidViewstate" value="true" />
<add key="EasyErrorHandlerIgnoreNotExist" value="false" />
<add key="EasyErrorHandlerSameErrorInterval" value="1" />
When an error occurs, users can be redirected to a nice custom error page instead of the common .NET error details page while the error details are still getting sent via email or logged into a database table.
To allow custom errors, add the following entries in the "<system.web>" section of "<configuration>"
<customErrors defaultRedirect="~/Error.aspx" mode="On" />
</customErrors />
Notes
See the sample "Global.asax" file attached with this project in order to learn how you can use our mail object - Easy Email Sender for sending errors to the web master including an option to copy other users,
(use our Send An Email practical example in order to make sure that your SMTP variables are correct)
An instance of this class should be created inside the "Application_Error" event of "Global.asax" and the boolean property "ErrorReported" can be used to check if there was an error detected to be handled with.
For testing, an error can be simply raised by using: throw new ApplicationException("Error for testing");
See the attached sample file for rasing an error EasyErrorHandler/RaiseAnError.aspx
(make sure you setup SMTP user name, password, etc. in Web.config)
  • EasyErrorHandlerActive is used to turn on and off error reporting (value can be "true" or "false")
  • EasyErrorHandlerIgnoreInvalidViewstate is used to turn on and off error reporting for Invalid viewstate errors that are mostly generated due to an Internet Explorer bug, for more information see Invalid viewstate when loading ScriptResource.axd or WebResource.axd (value can be "true" or "false")
  • EasyErrorHandlerIgnoreNotExist is used to turn on and off error reporting for non existing files as search engines and bots may try to access files that do not exist (value can be "true" or "false")
  • EasyErrorHandlerSameErrorInterval is the time in minutes that is used to make sure that not too many emails are being sent all together in a case of an error generated by many users and caused by the same reason, ErrorURL and Message are being used as a distinguishing signature.
The following error sample can be generated using the EasyErrorHandler class and then be sent via email
Error URL http://micromighty.com/SDK/EasyErrorHandler/EasyErrorHandler.aspx
Request N/A
User Info Not Authenticated
IP Address 34.236.153.51 (http://www.IP2Location.com/34.236.153.51)
Server Info Server Name : MY_MACHINE
Time Stamp 12/18/2018 2:56:31 AM
OS WinNT
Browser IE8 (Internet Explorer Version 8.0), ActiveX=True, AOL=False, Beta=False, Crawler=False, Cookies=True, Frames=True
Message Error for testing
Source System.Web
Target Void OnInit(System.EventArgs)
Stack Trace at Home.OnInit(EventArgs e) in http://micromighty.com/SDK/EasyErrorHandler/EasyErrorHandler.aspx:line 31
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Inner Ex N/A
Form Data N/A
You can use this SDK for personal use only, any commercial use or use for other
type of organization including non profit on a production server is not allowed.

You may not publish, sell, re-distribute, rent, lease or re-license any content
contained in this source code and/or DLLs and/or other components of the SDK
without an explicit written permission agreement signed by MicroMighty, Inc.

MicroMighty, Inc. reserves the right to permanently cancel without any warnings
neither refund a license that is suspected of being used illegitimately or that
violates the EULA (http://MicroMighty.com/SDK/EULA/)