Coldfusion IIS 7 custom 404 blank page - iis-7

In order to respond in any cfm with a cfheader statuscode=404, in web.config I have setup this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
That's works great.
To respond with a custom page when the client access to an inexsistent page, I have setup a Custom 404 page to a cfm in IIS7 manager but it respond with a blank page (with 404 code) and not my custom cfm page.
How can I configure IIS to respond with a custom page AND passthough from cfheader ?

Take a look at this link that answers a related question. The solution was found on a server running ColdFusion 9 Standard but I believe the result will be the same on ColdFusion 10, since my own problem - discussed in another thread - began with that version.
Long story short: For problem-free operation you must put a 404 handler under the web root of your site and use IIS Error Pages to specify that ColdFusion page as the 404 handler for the site. Complete details in the link.

Control Panel, Admin tools, Sites, Error pages.

Related

IIS ARR overrides application custom 404

I have several web servers and the proxy based on IIS ARR to balance the load between the web servers.
If user goes to not existing page web server returns custom "notfound" page with 404 status code (works correct if I do not use proxy) Unfortunately it has been overridden by the ARR and I see IIS standard 404 screen instead of returned from web server (as on picture http://i.snag.gy/v1xvY.jpg).
Does anyone know how this the overriding can be avoided to allow users see the custom 404 page?
Thanks in advance
Add
<httpErrors existingResponse="PassThrough"/>
to your web.config file. It should look something like this:
<configuration>
<system.webServer>
<httpErrors existingResponse="PassThrough"/>
</system.webServer>
</configuration>
If you're developing an ASP.NET application, put it in the application's web.config file, not the proxy's.

Custom 404 error page in Sitecore don't appears when file (.pdf and other) not found

I've created a custom error page, using this article. This custom error page appears only when aspx page isn't find, and when file(like pdf and other) isn't find - default google's error page appears. How to get custom error page for files? I've tryed to implement this solution on two different machines: on local machine custom error page appears for both .aspx pages and files, but on a server this solution works only for .aspx pages, though config files are the same. What I'm missing? Maybe there are different IIS configuration on this machines, or something? Thanks in advance.
I think this will help you.
<system.web>
<customErrors defaultRedirect="Error.aspx" mode="On">
<error statusCode="500" redirect="Error.aspx"/>
</customErrors>
</system.web>
U can add additional tags and mention available error codes and the page where you want to redirect.
Try setting your Error Page directly in IIS. Take a snapshot of your Web.config before you do this as I'm pretty sure it's going to be modified by IIS once you make this settings change. If memory serves me right you'll see this change in system.webServer and not system.web.
Be advised, if you are operating in a web far though, using mixed version of IIS (Server 2008 and Server 2008 R2 for instance), I've found the settings for 2008 R2 to not be compatible with 2008.

404 handling - Difference between local ASP.Net (C# 4) and remote server (live)

I'm facing a problem:
I do want to do URL rewriting with ASP.Net
It works perfectly using my local settings, but once on the server it doesn't work as expected.
Local
Request to /unavailable-file.aspx gets well in the Application_Error (Global.asax.cs) and then is being redirected to /404.aspx
Request to /unavailable-random-folder or any other file gets well in the Application_Error (Global.asax.cs) and then is being redirected to /404.aspx
Remote
Any request to a .aspx file WILL be catched in the Application_Error
Every other request (.jpg, folder, etc...) will NOT be catched at all and thrown into the default 404 page error
My problem:
Yesterday I was installing my new website to the server and I saw that Application_BeginRequest was not even fired AT ALL on my server, when it was every time (for every file or folder requested) in my local computer (with visual studio).
I had to create an HttpModule and now I am successfully getting the events firing... but not for non .aspx requests.
Everything seems to be bound on the URL : when it ends with .aspx it's correctly managed and when it's not, it's just not managed at all.
What should I do to catch every Application_BeginRequest even for non aspx page?
I have that in my web.config to try to force the 404 errors into my page:
<customErrors mode="On"
defaultRedirect="404.aspx">
<error statusCode="404" redirect="404.aspx"/>
</customErrors>
But as I said, as long as it's not a request ending with .aspx it's not being redirected and I get the default ASP.Net 404 error.
(My host is "reliablesite" if it can help, and I have the settings of the 404 errors pointing to my 404.aspx page inside the manager (shared hosting), it does not change anything)
I wish everything would work as in local mode.
If you have any tip on how to resolve that problem let me know.
In the development web server every request is handled by the aspx engine, as that's all there is. In the live server different file types are handled by different engines.
To make the live server use the aspx engine for every request you have to change the configuration in IIS for the web site.
Related: ASP.net web.config doesn't catch all 404's
The solution of this problem is given here when you have a shared environment:
Active the ASP.Net Integrated Pipeline in your shared environment settings (a thing that is available since IIS 7)
Add this to the web.config:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="RedirectHttpModule" type="RedirectHttpModule" />
</modules>
</system.webServer>
Where RedirectHttpModule is a custom module handling Application_BeginRequest for example.
The "runAllManagedModulesForAllRequests" means that all managed modules will be invoked for all requests to web application.

Why is IIS 7 showing me a default 403 page?

I have setup an asp.net 4.0 site where if someone tries to access an authorized area they get redirected to a SignIn page and the status is set to 403.
On my local machine it redirects to the SignIn page with the 403 status. On IIS 7 I get a nasty 403 Forbidden page instead of the SignIn page.
How can I get it to work on IIS 7 like it does on my Local?
IIS has default pages for all the HTTP error codes. You can override these in IIS to redirect to your own page.
IIS also recognizes the ASP.NET tag in the web.config file and uses that first if it's available, so you will need to setup your custom errors tags as follows:
<customErrors defaultRedirect="defaultError.aspx" mode="On">
<error statusCode="403" redirect="my403page.aspx"/>
</customErrors>
Hope this is what you're after. You can also use forms authentication in ASP.NET to achieve this, it uses cookies but works quite well with the scenario you described, unless you specifically need them to be redirected to a 403 page.
By "nasty" it sounds like you mean that IIS is throwing up its default 403 err message page. You could set the custom 403 error in IIS to redirect the user to your friendly signin page.
Not sure that's the best design, necessarily, but it probably would solve your problem based on how you've explained it...
I would check to make sure the authentication settings in your web.config file are the same in both environments.
EDIT
You might also be running into a problem with the anonymous authentication identity. I've run into this issue myself when first moving a site to IIS7. MSDN has a page the runs through your possible options.

Error Handling URLS that do not exist

I'm having problems with handling URLS that do not exist...
In my development environment, I navigated to http://localhost:XXXX/FakeLocation and would catch the HttpException and handle it properly.
When I deployed to my production location, I'm getting a 404 error when I navigate to http://MyProductionURL/FakeLocation. How can I make the production location throw the HttpException so my code can handle it similar to how it works in my development environment?
ASP.NET will only handle file extensions it is registered in IIS to handle. So if the page was foo.aspx, then by default, ASP.NET returns the 404 page as set in the web.config. And by default 404 for foo.xyz will be handled by IIS because IIS handles anything that doesn't have a mapping.
This page shows how to set up wildcard mapping so that all requests, regardless to extension are handled by asp.net.
You probably need to configure IIS on the production location. The easiest thing you can probably do is
Go to the Control Panel, and under Administrative Tools open Internet Information Services (IIS).
Right-click on your web site to bring up the properties.
Go to the Custom Errors tab
Select to the 404 error and edit properties on it.
Change the Message Type to URL.
Set the URL to the page you want them redirected to.
you can do this in the custom errors node of the web.config
<configuration>
<system.web>
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly">
<error statusCode="500"
redirect="InternalError.htm"/>
</customErrors>
</system.web>
</configuration>
Msdn Reference
Looks like IIS handle this exception and does not pass error to ASP.NET.
Please check http://www.chat11.com/How_To_Setup_A_Custom_404_Error_Handler_In_.NET

Resources