Understanding a 404 error in IIS - iis

I have a classic asp web application in which I've created a custom friendly 404 page. Also within that page, I have logic to email me the 404 info so I can check it out as to why it happened.
One of the pieces of info I email to myself is
Request.ServerVariables("HTTP_REFERER")
As I understand it, it should tell me the origin of the 404, ie. the page which is making the request to the file that doesn't exist.
However, I get notifications where the Referer is referencing a page in my site that doesn't exist in the first place. How can this be? Am I pulling the wrong ServerVariable? Is someone trying to do some cross site scripting?

Related

Intercepting SharePoint error messages in IIS

Is there any way to intercept SharePoint error messages in IIS?
For example, when I type this url: https://mywebsite.com/~.aspx, SharePoint answers with its own error page that says:
Sorry, something went wrong
The file or folder name contains characters that are not permitted. Please use a different name.
I would like to intercep this error message (and all SharePoint error messages) and redirect to my own custom error page.
Please note that:
When SharePoint shows this error in its own error page, the url remains the same (https://mywebsite.com/~.aspx)
When I inspect the page (F12) in the Network tab (using Chrome) the response is 200 OK, so no SharePoint is not reporting the error number back.
I expect to be able to somehow configure IIS in order to intercept any SharePoint errors and then show a custom made page instead of showing the standard and internal SharePoint error pages.

Can a hard-set a status code in the web.config?

I would like to return a 404 status code for every single request to a website. I still want to deliver a page of content, but I want the status code on every single request to be 404. (It's weird, I know, but there's a specific reason...)
I know I could do with this an HTTP Module or an OWIN pipeline, but I'd like to do it without writing or deploying code, if possible. However, this is a very weird situation, so I'm not sure if this is possible.
Can I set this from the web.config?
As lex says, we couldn't return the right content page with 404 error status.
Here is a workaround, we could try to use custom error page to achieve your requirement. If it should return 404 error, you could redirect the page to custom error page. But you should use the url rewrite to redirect all the pages to a not existed page.
Details about how to use custom error page in IIS, you could refer to this article.
Details about how to use url rewrite, you could refer to this article.

How to check a site if it is having a custom 404 page or a default one?

I am creating a SEO Audit tool using NodeJS. I want to check if a URL has setup a custom 404 page or not. How can I check ?
I have analysed the response for both custom 404 page and default one both return same content-type and response headers. Both return HTML content only so how can I decide if it is a custom 404 page or not.
If this is very important for you to know (maybe you are selling custom 404 pages), you'll need to examine the HTML returned by the request.
Many popular servers, such as tomcat, iis, and apache return a standard 404 page that you should be able to recognize. Same thing with frameworks such as django or rails. You could build some logic that compares 404 results with the "fingerprints" of a known population of default 404 pages.
For example certain versions of tomcat have a title on their error pages that looks like this:
<title>Apache Tomcat/7.0.50 - Error report</title>
If you see something that looks like that you can be pretty sure that you are dealing with the default tomcat error page.
There are machine learning techniques that can probably do this for you without needing to compile a library of 404 page fingerprints (similar to filters that distinguish spam messages from legit ones).

404 Error Hijacked by Time Warner

I created a customized 404 page in IIS. If a user types in the name of one of our employees in the url: www.ourdomain.com/firstname the 404 page grabs the firstname and forwards you to the bio page for that person. If it doesn't find the string as a name it just serves up our custom 404 error page.
This is working beautifully with one exception. When you are using Time Warner as your ISP instead of loading the custom 404 page I get an error message that says, "The connection was reset...." it has a try again button at the bottom.
Any ideas on how I can get Time Warner to serve up my custom 404 error message?
I came up with this on the Mozilla Forum, it appears to be ISP's and their greed. Re-routing 404 traffic to pages of their choice likely to improve revenue. It appears the best method is to complain to their customer service however I'm unsure how it will help if its only been a few to complain (so far).
UPDATE
It appears someone has found a way to disable this.

where can i find the default 404 error page for windows sharepoint service 2.0

Where can i find the default htm file, mapped to show the 404 error in Sharepoint service 2.0. Currently whenever the request for a site hits the 404 error, it goes to the default page, but the point to note here is, which is not the one we set in IIS custom error option.
My requirement here is to make few modification in the 404 error page. I tried mapping the request to a custom error page with <customErros> tag in web.config. But unfortunately, its still showing the default 404 error page. When i checked the viewsource of the error page i can see some comments like, res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm
Any idea about this? Thanks in advance
I haven't had to do this but this entry looks quite reasonable: http://blogs.msdn.com/b/jingmeili/archive/2007/04/08/how-to-create-your-own-custom-404-error-page-and-handle-redirect-in-sharepoint-2007-moss.aspx
Basically when you install WSS it hi-jacks IIS. You can still do most of the things you would expect but you need to go through the Central Administration pages and the XML files that control many aspects of SharePoint.

Resources