Solved

404 not working for a non .aspx extention

Posted on 2006-06-24
4
292 Views
Last Modified: 2012-05-05
I've added whats required in the web.config file

    <customErrors mode="RemoteOnly" defaultRedirect=/DefaultError.aspx">
      <error statusCode="404" redirect="FileNotFound.aspx" />

This works fine for whenever i try to type in a webpage with a .aspx extention that doesn't exist.  However, if i just try to type in "mysite.com/stuff" then it doesn't seem to trigger the 404.  Does anyone have an idea why?  Thanks.
0
Comment
Question by:UnexplainedWays
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
DavidBook earned 500 total points
ID: 16977895
when requesting this: mysite.com/stuff you are NOT requesting a URL but instead asking the webserver to serve up the default document in the /stuff directory. Normally, this is default.aspx, but could be configured to serve up index.aspx, default.aspx, index.html, default.html, etc. Each directory has  default document that will be served up if no specific URL is typed in. A URL always has a file name + extension. URL = Uniform Resource Location, or "web page". Since you are not typing in a web-page 404 won't trigger, 404 triggers when the URL is not found. No URL was requested. Get it? I would advise that you allow a default document, set IIS to serve up default.aspx, then, have default.aspx redirect to your "error page".

Hope this makes sense.
David.
 
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16977901
ok, thanks.
0
 
LVL 3

Expert Comment

by:DavidBook
ID: 16977944
Your welcome.
David.
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16977956
I went exploring around my hosting control pannel and they had a custom error page setting.  It does a different job to when there is a missing aspx file.  The local host seems to be catching all the errors with just the web.config, however my problem was on the server.

I didn't realise that a URL required an extention.  
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now