ASP Boilerplate always shows the default error message - aspnetboilerplate

I am using ASP Boilerplate (MVC + Jquery) to develop two different online applications. It works very good but there is a problem with ABP exception handler in both of them:
It always shows the default error message (An error has occurred! Error detail not sent by server) also in login validation.
How can I fix this problem?
I tried to debug this error and I realized that the error format that returned from server side is not a valid ABP error format.

please check in your web.config file that shoud be set to On
<customErrors mode="On" />

Related

Login fails and getting Runtime Error when submitting password of a specific pattern

I am using ASP.NET MVC for a project, Everything works fine. Recently someone reported that if he tried to login to the interface with this password J&Mg<in5 the interface showed error page I mean not even the custom 500 error page which we have configured and works otherwise.
I have elmah configured on this project, no error is shown there too.
I little more investigation showed that all password of type, examples below
<ee
<fd
<reee
i.e "<" followed by any character gave this error.
Why is this error coming, and how to resolve this ?
I think it's the request validation that triggers in this case. Try disabling it and see if it helps. Also, try looking at the event log, it should contain a bit more useful details on the matter.
Hope this helps.

MVC 4 - How do I turn off the default Error.vbhtml page?

Anyone know how to turn off the default error page or where it's referenced??
Alright, I figured it out.
Turns out that in my custom ElmahHandleErrorAttribute class, the OnException() method is indeed over ridden (as it should be). But the 1st line of code is "MyBase.OnException(context)", which will fire off what the HandleError attribute also performs.
Once I commented out that one line, my issue went away.
What's The Issue?
I have Elmah.Mvc implemented in this Mvc4 project, it's working beautifully. I also have a custom errors section in the Web.config as follows:
<customErrors mode="On" defaultRedirect="~/Error/General">
<error statusCode="404" redirect="~/Error/Http404" />
</customErrors>
I have an ErrorController with two action methods, one for "General" and the other for "Http404".
What was happening was if I raised an unhandled error, I would indeed get my raised exception logged in Elmah, an email delivered with the exception, and then the custom "General" view displayed (Http404 page if it was a 404 error).
BUT, what I was also getting was an additional logged exception AND email because the default "Error.vbhtml" file was not found (I removed that view).
Honest mistake...hope this helps someone out moving along. :)
You can control this using the customErrors element in the web.config file.

how do i fire elmah logger after Application_Error

I'm small mechanism that analyse 404 errors
i have small xml that contain old urls and redirect it to new
im doing it in Application_Error but i see that elmah log error first and the fire Application_Error, it mean that if old url will be found in xml elmah will log error anyway :(
is it possible to somehow fix it?
thanks

Other errors find my Error.cshtml, why doesn't 404 error find Error.cshtml?

I am tackling ASP.NET, MVC 3, web development, for the first time, all at the same time. Please bear with me, as I know this subject has been discussed heavily from different angles. I still have not found the answer to my specific question: Why doesn't my application find my Error.cshtml file when a 404 occurs, when it finds it just fine with other errors?
(Environment: Win 7 64bit, IIS7, SQL 2008 Express, VS2010, ASP.NET 4, MVC3, EF v4)
I have a controller, WorkerController.cs, that correctly reads and writes from the database. If I change the database name without updating my DbContext, it gives me an error. When I change web.config to always show custom errors, shows me the /Views/Shared/Error.cshtml file.
I do not have a FooController.cs file. If I go to /Foo, I get a 404 error, as expected. It tells me it cannot find the resource /Foo.
When I set customErrors mode="On" and make an http request to /Foo, I get a 404 error saying that /Error.cshtml cannot be found.
I am searching for and reading the posts that discuss the various methods of handling errors with designated controllers, but I really want to know what I'm missing. Why does it find /Error.cshtml for other errors, but not the 404 error?
Other than setting customErrors="On", have you defined a specific redirect for 404 errors?
If you have, say, an ErrorController setup your web.config, for instance, like:
<customErrors mode="On" defaultRedirect="/error/Problem">
<error statusCode="404" redirect="error/FileNotFound"/>
</customErrors>
Or of you'd prefer static html pages for your errors:
<customErrors mode="On" defaultRedirect="Problem.html">
<error statusCode="404" redirect="FileNotFound.html"/>
</customErrors>
You might want to take a look at this other question for some more information:
ASP.NET MVC HandleError.
For improved error handling in MVC, though, you could also take a look at ELMAH (Error Logging Modules and Handlers):
You can (should)! get ELMAH as a NuGet package; the installer will do most of the setup for you
Take a look at Scott Hanselman's "introductory" post
Check this question/ansers on how to use it with ASP.NET MVC: How to get ELMAH to work with ASP.NET MVC [HandleError] attribute?

Turn IIS7 HTTP Error Handling Off?

I just got setup on my first Windows Server 2008 / IIS7.5 server for a contest I am participating in. I can't for the life of me figure out how to turn OFF error handling COMPLETELY. The only options I see are:
Custom
Detailed
Detailed Local, custom for remote
I want to turn the feature off completely, and I don't see any way to do that. Am I missing something?
My Situation:
I have a RESTful PHP framework that catches exceptions and emits an HTTP 500 status if the exception has not already been handled. It then puts the specified exception message in the response body and sends it to the browser. This works fine in Apache - the correct headers are sent and the message is displayed to the user. In IIS, however, the response for 4xx and 5xx HTTP status codes is always intercepted and injected with some other prepared message or HTML file, and that's exactly what I don't want it to do anymore. Please help!
After some more extensive searching, I found the answer here:
http://blogs.msdn.com/webdevelopertips/archive/2009/08/24/tip-93-did-you-know-php-and-custom-error-pages-configuration.aspx
The solution is to manually edit your web.config file with this custom "httpErrors" entry:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
However, due to IIS 7.0 "lockdown" feature you might get a "This configuration section cannot be used at this path. This happens when the section is locked at a parent level." error. To solve that, execute the following in the command prompt:
cd C:\Windows\System32\inetsrv
appcmd unlock config /section:httpErrors
In IIS Manager -> Site -> Error Pages, right-click each error page and choose ‘Remove’.
Unfortunately there is not a way to tell IIS not to interfere from the script side, so it's always an annoying deployment issue.

Resources