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 />
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 |
44.192.25.113 (http://www.IP2Location.com/44.192.25.113) |
Server Info |
Server Name : MY_MACHINE |
Time Stamp |
5/25/2022 9:22:22 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 |