Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

404 not working for a non .aspx extention

Posted on 2006-06-24
4
Medium Priority
?
320 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

927 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