Display Custom Error Page for All Errors in IIS - asp.net

I have a few sites in my IIS including ASP.Net and PHP. I want to define a custom pages for error handling that I can configure in IIS and it displays on errors occuring in all the sites. Say for example if error 500 is occured it displays an ASP.Net page having detailed error info of what happened actually. Is that possible?

No. = (
PHP
For your PHP sites, there are different solutions including error-logging plugins, but the standard one involves the built-in functionality of PHP's error handling. See here: http://www.nyphp.org/PHundamentals/7_PHP-Error-Handling
ASP.NET
For ASP.NET sites, this is the default behavior of the IIS error page. It will show you the exact error code, stack trace, and offending lines of code. If you wanted to, you could create your own application-level error handler to handle any and all exceptions that can occur inside your site; usually this is used to hide the nasty error message and show the user a friendlier, less-scary message instead. You can certainly re-use the code in all your different ASP.NET sites. See: http://www.codeproject.com/Articles/5977/Global-Error-Handling-in-ASP-NET

Related

404 inside application.cfm - yet page loads and cgi variables change?

I'm having a few issues with my site where certain pieces of script were failing within the application that involved checks on things such as the cgi.script_name. I've managed to trace this back to an issue which is caused by my web.config file. I ran a cfdump inside a cfsavecontent file within the application.cfm and then wrote the file into my stucture and loaded up the HTML page.
I found that at the time the dump was performed, the cgi.script_name value was /errorpages/404.cfm yet the page loaded normally and the cgi.script_name reads /cart.cfm? I'm very confused. I've currently disabled ANY error setup and it works fine, but within Error Pages on IIS7, i had originally set up the 404 to execute /errorpages/404.cfm and under the error feature settings to throw a custom error page when it encountered an error. Does anybody know where the hell i am going wrong?

IIS/ASP.NET custom error pages on OOM/SO

We have some logic for displaying custom error pages in our ASP.NET application through overriding Page.OnError. Now, when an error occurs within that error handling routine I can redirect somewhere else using the in web.config.
This works for most errors. Yet, I cannot find how to display a custom error page (or anything at all!) when getting e.g. a StackOverflowException. Obviously I cannot do any more processing insode ASP in such a case as practically anything will result in some allocation on the stack. The same is probably true for OutOfMemory, though I have not found any sensible way to test this. Is there any possibility I could still display something (possibly static) to the user, e.g. directly from IIS instead from ASP?

errors with the php filter module

When I purposefully throw a php error from within embedded php code in the php filter module, Drupal displays the message The website encountered an unexpected error. Please try again later.
We like to send users with unanticipated programmer errors to an error handling page so that they don't land on a dead error page without us getting notified, so I'm trying to find out how to intercept this in Drupal. I've tried searching within Drupal for where this error string gets outputted, with no luck.
How exactly does Drupal handle errors occurring within embedded php code, or more directly: how can I make it redirect to another page or catch the error in another way?
Thanks
That specific error comes as a result of Drupal explicitly setting the PHP exception handler to a custom function (done in _drupal_bootstrap_configuration()).
The exception handler itself is _drupal_exception_handler(), which invokes _drupal_log_error(), and that's where the error page is generated.
I've never tried it, but I reckon you'd get away with implementing hook_boot() and using set_exception_handler() to provide your own implementation of the core Drupal functions to theme that error page differently.
It might seem a bit of a long way round but since _drupal_error_log() doesn't invoke any hooks (it probably happens too early on for that anyway) I can't see any other way to do it without editing the core files.

cd_link.PageLink GetLinkAsString(...) causing pages to fail every other request

I am currently migrating from Tridion R5.3 to Tridion 2011. I am having issues with serving some pages through the presentation server. For reference all of my web pages are classic ASP and I am running them on IIS7.5.
I have have a page located at http://www.example.com/widget/index.asp. When I first access the page I get a The page cannot be displayed because an internal server error has occurred., if I then refresh the page it loads fine, if I refresh the page a third time it comes up with the error. The page works every other request.
I have enabled Failed Request Tracing on my website and I am getting the error
ASP_LOG_ERROR
LineNumber: 87
ErrorCode: 800706be
Description:
Note there is no description.
The code being called is
85: Dim objTranslationPageLink
86: Set objTranslationPageLink = Server.createObject("cd_link.PageLink")
87: strTranslatedPageLink = objTranslationPageLink.GetLinkAsString("tcm:0-12-1", "tcm:12-123456-64", "", "", "TranslationFound", False)
88: Set objTranslationPageLink = Nothing
It looks like there is no problems creating the cd_link.PageLink object, just when calling the GetLinkAsString(...) function.
I use the cd_link.PageLink object in lot of other pages with no problems but it seems with pages that use this specific piece of code experience the problems.
I was thinking it could be something to do with caching pages however I turned off caching of ASP pages (IIS7 > ASP > Services > Caching Properties) and still had the problem.
Any ideas?
edit1
The code worked fine on Windows Server 2003 IIS6. I am trying to make it work on Windows Server 2008 IIS7.
edit2
It appears that the page is creating a lot of cd_link.ComponentLink and cd_link.PageLink objects. I have a test page in which I create 10 ComponentLink objects I get the error (every other page) but if I reduce this to 5 ComponentLink objects it works every time.
edit3
My cd_core.xxxx.xx.xx.log has the following errors
2012-11-02 11:55:34,027 ERROR XMLConfigurationReader - Error while validating file 'cd_link_conf.xml' with schema 'schemas/cd_link_conf.xsd'. cvc-complex-type.3.2.2: Attribute 'DefaultRootLocation' is not allowed to appear in element 'Publications'.
edit4
Thanks for bearing with me. The problem I was having with my cd_link_config is fixed and doesn't appear to have been be related. I now have no errors in my any of the four log files (cd_core, cd_deployer, cd_monitor, cd_transport) but the original issue persists.
Looks like you are running the CD Link windows service and the following hotfix might help to resolve your issue. I have not tried this hotfix but the description says Page link fails on second attempt of accessing the page, so that means it might work sproadically depending on the logger memory resources.
Anyway worth looking at this hotfix : CD_2011.1.0.78355
Description: The Linking windows service was not correctly cleaning up a logger memory resource on certain windows platforms
It is a long time since I worked with Classic ASP and SDL Tridion, but double check the following
Is the linking service running on the server?
Check your cd_licenses.xml file is in place
Validate that you have a correct cd_link_conf.xml and cd_storage_conf.xml (these changed from 5.3 I believe)
Look in the Application and Tridion event logs for clues
The Tridion linking log files
That error code seems to imply that the Linking DLL is not registered properly.
That is all I can think of for now.
I didn't realise that 2011 actually schema-validates the config files, but in any case, now the error is clear. I'd suggest doing the validation yourself in an XML editor such as XML Spy. That should point out exactly what's wrong with the configuration file.
To routinely check your configurations, you may find it interesting to script it as described here.

Design Pattern for error handling in ASP.NET 3.5 site

I am relatively new to ASP.NET programming, and web programming in general. We have a site we recently ported from .NET 1.1 to 3.5. Currently we have two methods of error handling: either catching the error during data load on a page and displaying the formatted error in a label on the page, or redirecting to a generic error page. Both of these are somewhat annoying, as right now I'm trying to redesign how our errors are displayed.
We are soon moving to Master pages, and I'm wondering if there is a way to "build in" an error handling control. What I mean by this is using a ASP.NET user control I've designed that simply gets passed the error string returned from the server. If an error occurs, the page would not display the content, and instead display the error control. This provides us with the ability to retain the current banner/navigation during an error (which we don't get with the generic error page), as well as keeping me from having to add the control to every aspx page we have (which I have to do with using the label-per-page system). Does something like this make sense? Ultimately I just want to have the error control added to a single page, and all other pages have access to it directly. Is this something Master pages help with?
Thanks!
User the application_error event in the global.asax to catch all your unhandled errors - you can log them here. You shouldn't be outputting error messages to the client like this.
Use the CustomErrors section in the web.config to define a custom error page for your users to get.
You could also look at using something like ELMAH for easy loggin.

Resources