Solved

404 not working for a non .aspx extention

Posted on 2006-06-24
4
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to dynamically set the form action using jQuery.

617 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