custom-error-pages

PHP - Display a 404 Error without redirecting to another page

房东的猫 提交于 2019-11-28 06:32:52
I want to display a 404 Error if a user reaches a page that exists but I don't want him/her to see. I don't want to do redirect (that would cause the address bar to show the link of the error page in the address bar) like the following: if ($this_page_should_not_be_seen) header("Location: err.php?e=404"); Instead, it should seem like the page really doesn't exist, without having the URL in the browser's address changed. Emil Vikström Include the error page in your current page and send a 404 error status code: <?php if ($nobody_should_ever_be_here) { header('HTTP/1.1 404 Not Found'); //This

Configuring custom ASP 404 page with redirect for IIS7 website

折月煮酒 提交于 2019-11-28 02:10:26
We're migrating an existing website from IIS6 to IIS7, but are experiencing some difficulty in setting up the 404 error page. Our 404-errorpage works like this: A custom ASP-page checks the URL against a short list of 'special' URLs (e.g. http://example.com/limited-offers ). If the URL is known, it redirects to the actual URL of that page. Otherwise the visitor is redirected to a static errorpage with a 404-statuscode. With IIS6 this worked as advertised, but with IIS7 some things have changed. IIS7 will always display the configured errorpage when it encounters a statuscode for which an

ViewExpiredException shown in java.lang.Throwable error-page in web.xml

徘徊边缘 提交于 2019-11-27 22:07:20
I'm working on a JSF web application in which I need to bring up a "Session Expired" page if the view expires, but a general technical error page for all others. The application only goes to the technical error page when I trigger the exception. Here's the error-page definitions: <error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/jsps/utility/sessionExpired.jsp</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/jsps/utility/technicalError.jsp</location> </error-page> <error-page> <error-code

HttpError iis config throws exception when default path is added

心不动则不痛 提交于 2019-11-27 18:21:02
问题 I have this config which works and redirects the following errors correctly <httpErrors errorMode="Custom" existingResponse="Replace" defaultResponseMode="ExecuteURL" > <remove statusCode="403" /> <remove statusCode="404" /> <remove statusCode="500" /> <error statusCode="403" responseMode="ExecuteURL" path="/Error/AccessDenied" /> <error statusCode="404" responseMode="ExecuteURL" path="/Error/PageNotFound" /> <error statusCode="500" responseMode="ExecuteURL" path="/Error/ApplicationError" />

How do I display custom error pages in Asp.Net Mvc 3?

三世轮回 提交于 2019-11-27 17:15:46
I want all 401 errors to be be redirected to a custom error page. I have initially setup the following entry in my web.config. <customErrors defaultRedirect="ErrorPage.aspx" mode="On"> <error statusCode="401" redirect="~/Views/Shared/AccessDenied.aspx" /> </customErrors> When using IIS Express I receive the stock IIS Express 401 error page. In the event when I do not use IIS Express a blank page is returned. Using Google Chrome's Network tab to inspect the response, I see that while the page is blank a 401 status is returned in the headers What I have tried thus far is using suggestions from

Create a custom DNS error page

孤街醉人 提交于 2019-11-27 14:14:14
问题 I am building a new extension and I would like to customize the default error page in Google Chrome. I have gone through the "Override Pages" documentation here but have yet to find anything about customizing the page I have specified. Any suggestions are much appreciated. Thank you. The error page I want to customize is: This webpage is not available The server at _ ___ can't be found, because the DNS lookup failed. DNS is the network service that translates a website's name to its Internet

ELMAH - Using custom error pages to collecting user feedback

只谈情不闲聊 提交于 2019-11-27 14:07:40
问题 I'm looking at using ELMAH for the first time but have a requirement that needs to be met that I'm not sure how to go about achieving... Basically, I am going to configure ELMAH to work under asp.net MVC and get it to log errors to the database when they occur. On top of this I be using customErrors to direct the user to a friendly message page when an error occurs. Fairly standard stuff... The requirement is that on this custom error page I have a form which enables to user to provide extra

How to get the message in a custom error page (Tomcat)?

我们两清 提交于 2019-11-27 13:09:04
In JSPs, you may use response.sendError(int code, String message) to return a particular error code (eg 404 for not found) and a message as well. These messages display fine, as long as you use the default ugly Tomcat error pages. However, if you create a custom error page, how do you get that message? I've tried exception.getMessage() or pageContext.getErrorData() but no avail. I've been searching for this for like hours and nobody seems to even wonder about the same thing! :S I forgot to mention I've only tried it with 404s so far, since that's what I need most... The exception is null for

ASP.NET MVC 5 Custom Error Page

故事扮演 提交于 2019-11-27 10:08:20
问题 I am using a custom authorize attribute in a ASP.NET MVC 5 application like following: public class CustomAuthorizeAttribute : AuthorizeAttribute { protected override void HandleUnauthorizedRequest(AuthorizationContext context) { if (context.HttpContext.Request.IsAuthenticated) { context.Result = new System.Web.Mvc.HttpStatusCodeResult((int)System.Net.HttpStatusCode.Forbidden); } else { base.HandleUnauthorizedRequest(context); } } } In system.web section of my web.config I mentioned error

Apache's ErrorDocument directive does not redirect

梦想的初衷 提交于 2019-11-27 08:06:28
I have a bunch of ErrorDocument directives in my .htaccess file in order to catch almost all the possible errors Apache can throw at a user, and to redirect said user to my error controller which would then render the error in a more user friendly manner. However, it does not seem work. For instance, when I enter an invalid URL like mysite.com/""##$##$! I always get Apache's default 403 error message, instead of a redirect to my errors.php file. Below is the directive I'm using. Do I need to do anything else to make it work? (AllowOverride All is set) ErrorDocument 403 /errors.php If this is