custom error page doesn't show - asp.net-mvc-2

I am trying to get an ASP.Net MVC2 app to display a simple custom error rather than the yellow screen. I have already set up elmah to silently log the error in the background but while that happens I want to display a simple static error message based on the view in Shared/Error.aspx. Nothing fancy, just a plain vanilla "there was an error".
<customErrors mode="On" defaultRedirect="~/Error.aspx" />
I thought this was simply a matter of adding a customError tag to my config but I am still seeing the yellow page. Do I have to write a custom action handler for the Error.aspx view before I can use it? Could this be due to some interaction with elmah?
Thanks!
Duffy
Update: It seems that the problem is NInject getting in the way of handling a static error page. The yellow sceen error I am seeing is not for the original error message but the NInject Factory not finding a controller for error.aspx.

I still have no idea why failed to find my static error files. However, I finally got around the problem by defining an error controller and changing my web.config to this instead.
<customErrors mode="On" defaultRedirect="/Error/GenericError" />

Related

Controller not getting loaded with custom tile

I have made a custom tile with sap ui5 using generic tiles.Now i'm using it as my custom tile in fiori launchpad.So,when the application loads , it loads the xml view for the tile but gives 404 error for the tile's controller.
The view instantiation resulted in js errorError: failed to load
'tile2/viewTile/controller/View1.controller.js' from https://sapui5.hana.ondemand.com/1.64.0/resources/tile2/viewTile/controller/View1.controller.js: 404
Though the xml view is getting loaded also the namespace and everything else is getting configured automatically
Name:
viewtile.view.View1
Prefix:
viewtile
Path:
/sap/fiori/viewtile/
Getting this
Actual result should be
Please check your configuration and paths.
The error message says:
“… failed to load … from https://sapui5.hana.ondemand.com/1.64.0/resources/tile2/viewTile/controller/View1.controller.js: 404”
You won’t find your own developed View1.controller.js on https://sapui5.hana.ondemand.com/1.64.0 .
A similar problem was discussed here: https://answers.sap.com/questions/98633/fiori-launchpad-custom-tile-controllerjs-path-issu.html
The answer was to remove the application name from the view and controller files when deploying to the Fiori Launchpad.

Error rendering superform control

I am tying to add the Obout Suite superform control to my webpage.
The control is not rendering on the design page.
It gives an error saying
There was an error rendering the control. Object reference not set to an instance of an object'.
I have added the #Register directive:
(<%# Register TagPrefix="obout" Namespace="Obout.SuperForm" Assembly="obout_SuperForm" %>)
to the top of my page.
Can anyone tell me what is wrong?

How to scroll to first error inside a Spring form?

My registration is using Spring forms and validates the data after submit, the form:errors will be printed out if there are errors. I need to scroll the page down to the first form:error so the user hasn't to search for the error, is there a way to do that?
cheers
I haven't tried any of them, but I can think of two possible ways:
With Javascript. Spans generated by < form:errors /> have a class (I don't remember at the moment) or you can force on using cssClass attribute. Would be very easy using this jQuery plugin to scroll to the first one.
Without Javascript. This will be a lot more difficult and I'm not sure it will work:
In your controller, instead of returning a direct view you must do a redirect to something like /myForm#error.
In order to don't lose your model, you must use FlashMap attributes.
"Subclass" < form:errors /> tag. It must have the same behavior but it has to include an anchor named error on the first error of the page.
I think you can do it with anchors. -- But you need to implement it by your own.
My idea it to put anchors on all input files. And then have some java script that is able to scoll to an anchor. This java script is invoked on page load if the error object contains errors. -- This errors contains the name of the field. So if you have some schama for naming the anchors it should be possible to invoke the jump to an anchor script with the name of the field hat has an error.

JSF2.0 PrimeFaces Navigation Problem

I have a problem with navigation too right now. I have 2 dataTables, one is located within a regular facelets-page, the other one is located in a dialog.
Both have the same code:
<p:commandButton
value="Show car"
ajax="false"
action="showCar?faces-redirect=true">
<f:setPropertyActionListener value="#{car}" target="#{carBean.car}" />
</p:commandButton>
I also tried adding process="#this" without success.
The problem is, while the navigation works for the commandButton inside the facelets-page, it doesnt work for the button inside the dialog. It seems that the current page is reloaded after the click.
Replacing it with a doesn't help either.
Has anybody experienced something like this before? Could this be an issue with the dialog?
Thanks and best regards,
Robert
Forget my previous answer, I didn't read your question carefully. What might be happening is a failure in your <f:setPropertyActionListener> call. If it is (silently) failing then the error will cause JSF to automatically navigate back to the same page.
Add this to your page somewhere so you can see any helpful error FacesMessages that may be provided by the framework:
<p:messages
id="messagesForDebugging"
showDetail="true"
autoUpdate="true" />
The autoUpdate will cause it flash up messages generated by global Ajax requests.
You may also want to put a logging statement in your carBean.setCar() method to make sure that it is successfully setting the value. If it is failing then maybe you need to provide a custom converter for Car values?

How do I know when a page has failed to load in UIWebView as opposed to being "Stopped" by the user?

I have a UIWebView within my application which I'm using to provide web browsing functionality.
I have a button on my toolbar which calls
-(void)stopLoading;
on the UIWebView. The problem with this is that when this method is sent to the web view, the delegate receives the
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;
message. The error accompanying this call is: Operation could not be completed. (NSURLErrorDomain error -999.)
I also use the didFailLoad message to tell if the page actually failed to load - and in that case, I display an html formatted message to user to communicate this failure to them.
So the problem is that if the user hits the stop button, the error page is shown instead of just showing whatever parts of the page loaded before being stopped.
I had hoped that NSError.h contained an enum of error codes that I could compare against - but it seems like I'll have to make my own based on my observations of the error codes that come out in my logs - which is less than ideal, since they could change in the future...
Any suggestions would be great, thanks.
The best way I could find to solve this was to create an enum using the error codes given by the webView.
It doesn't look like they're going to change, but if they do, well - ho hum.
So now, in my failed-to-load method I simply compare the error code from the error object with my enum, and I can see what happened - looks kinda like this:
typedef enum {
BrowserErrorHostNotFound = -1003,
BrowserErrorOperationNotCompleted = -999,
BrowserErrorNoInternetConnection = -1009
} BrowserErrorCode;
Those error codes are defined in NSURLError.h, in the Foundation.framework