BIBD
BIBD

Reputation: 15414

Why would an aspx file return 404 ("The page cannot be found")

Why when I access an aspx (e.g., http://www.example.com/foo.aspx - not the real site) through IE6 would I get a 404 Error (i.e., "The page cannot be found") in IIS6

I've got scripts enabled for the website and I've tried with executables enabled as well.

Here is the full error:

The page cannot be found
The page you are looking for might have been removed, had its name changed, or
is temporarily unavailable. 
------------------------------------------------------------------------------

Please try the following:

Make sure that the Web site address displayed in the address bar of your 
browser is spelled and formatted correctly. 
If you reached this page by clicking a link, contact the Web site 
administrator to alert them that the link is incorrectly formatted. 
Click the Back button to try another link. 
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)

------------------------------------------------------------------------------

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the 
words HTTP and 404. 
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for 
topics titled Web Site Setup, Common Administrative Tasks, and About Custom 
Error Messages. 

I can get to Default.htm in the same directory, so I know the path is right. I've opened it up to everyone (temporarily) so I know the permissions are right.

Upvotes: 35

Views: 99453

Answers (14)

Vizions007
Vizions007

Reputation: 1

For an aspx page, error 404 can be quite misleading! I have seen all the answers and they presuppose assuming various issues with the file, page, path, etc. but the simplest issues is the fact that if there is an error in your asp page (i.e bad format, improper usage of control, etc. asp will think the page does not exist and will post a 404 when in all actuality, it is easy to ascertain if there is a bad format by simply clicking on design mode. If the page does not render no need to do anything else but look at what is causing the render error, fix and viola'! Your page shows since it was never missing or can't be found, but it simple did not know how to display! Too often people go looking for the wrong solutions and waste so much time! Hope this helps somone. :-)

Upvotes: -1

BA TabNabber
BA TabNabber

Reputation: 1356

Check for double quote errors. I started getting a 404 on a single page because I accidentally had this:

<asp:TemplateField HeaderText="ImageURL"">

instead of this:

<asp:TemplateField HeaderText="ImageURL">

Upvotes: 0

Andrew Rebane
Andrew Rebane

Reputation: 199

I had bin\roslyn compiler missing. Adding that all worked fine.

Upvotes: 0

Lanklaas
Lanklaas

Reputation: 2892

I got this issue when I tried using a different drive to host my apps. I ended up moving them to the wwwroot folder because it was working there and I did not have to time figure out why it is not working on the E:\ drive.

Upvotes: 0

hackingchemist
hackingchemist

Reputation: 166

I had this issue where some customers were reporting the 404.0 and some didn't have the problem at all(same page). I was able to navigate to any of the pages with no problems from my machine. Some customers would refresh and it would go away. I am using .Net 4.5.2 and IIS 7.5.

Looking at the IIS log file I would see:

sc-status sc-substatus sc-win32-status
404 0 2

sc-status.sc-substatus: 404.0 - Not Found
sc-win32-status: 2 - ERROR_FILE_NOT_FOUND
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx https://en.wikipedia.org/wiki/HTTP_404

I found the problem was I had deployed a new version of the website in which the old version of the website had RouteConfig.cs/FriendlyUrlSetting setup by creating a project using the web forms template. The new version was created using an empty template. So obvious to me now.. no URL routing. Customers had a cache issue with certain pages on their machine(no .aspx extension) and having them clear browser data ultimately fixed the problem.

Upvotes: 0

Michael Kropat
Michael Kropat

Reputation: 15237

I just happened to find another culprit for this issue. My foo.aspx page referenced a particular master page that had a <%@ Register %> directive to a user control that did not exist. Removing the reference to the non-existent user control caused my foo.aspx to load instead of 404.

Upvotes: 4

Neil
Neil

Reputation: 4049

If you register the .NET 4 version of IIS, you may find it's grabbed the registration of the aspx extension. If ASP.NET v4 is prohibited then 404 will be returned

Upvotes: 0

Tom Teman
Tom Teman

Reputation: 2013

I found a solution here. The real catch was using this:

Response.TrySkipIisCustomErrors = true;

Upvotes: 1

Joe
Joe

Reputation: 42666

It could be a lot of things. I had this issue today because .NET had not been re-initialized after installing IIS (aspnet_regiis -i -enable or equivalent).

Upvotes: 62

Rick
Rick

Reputation: 1

ALTERNATE SOLUTION (same error perhaps different cause).

I had installed Visual Studio 2008 Pro without SQL Express it, and it caused this same error. Reinstallation of VS2008 with sql express included seemed to have corrected the problem, or perhaps the install took other actions. I did try to register ASP.net numerous times prior but no luck however it is definitely the most probable cause Just posting my experience for those pulling their hair as I was..

Thanks

Upvotes: 0

bmm6o
bmm6o

Reputation: 6515

Ray and Joe probably have it. In order to serve any file type, IIS has to have a mapping for it. Aspx files require that they be mapped to the AspNet ISAPI dll, which the .Net installation normally takes care of. If you install IIS after .Net (and I'm sure there are other situations), you have to initiate this yourself by running aspnet_regiis.

Upvotes: 0

AnthonyWJones
AnthonyWJones

Reputation: 189555

Check that the anonymous user under which the site runs has read access to the file foo.aspx.

IIS6 and later uses a 404 response, thereby not letting an attacker know whether such a file even exists.

Upvotes: 4

Darryl Braaten
Darryl Braaten

Reputation: 5231

Check that www.example.com is going to the site that you think it is.

If you are hosting multiple sites on the same IP using host headers you may want to double check the name you are using is going to the site you think it is.

Upvotes: 0

Chuck Conway
Chuck Conway

Reputation: 16435

The site is pointing to a different directory where the page is not.

It could be permissions, however I would think you would get an access error instead.

I'm assuming you are running IIS.

Upvotes: 0

Related Questions