Why would an aspx file return 404 ("The page cannot be found") - asp.net

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.

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).

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.

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.

I found a solution here.
The real catch was using this:
Response.TrySkipIisCustomErrors = true;

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.

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.

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.

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

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

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.

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.

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

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">

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. :-)

Related

How could IIS seemingly pull a web page out of thin air on my ASP.net WebForms application?

I am contracted to support a legacy ASP.net WebForms application. It's a commercial web site, and it's quite old.
Yesterday, I received a trouble-ticket that seemed to defy everything I know about web applications.
The trouble-ticket indicated that a certain URL sometimes returned an HTTP 404 error. The submitter also swears that the problem only occurs when browsing the site with Chrome. The web application is available in English and French, but the trouble-ticket says that the problem only occurs on the French version of the web application.
The URL looks like this:
http://www.example.com/promotion/mg_547/SpecialOffer.search
I tried navigating to the page in my development environment: http://www.example.dev/promotion/mg_547/SpecialOffer.search. It seemed to work fine.
Although these URLs are fictionalized, "mg_547" is an actual directory name in the URL.
I decided to navigate to the file in Windows Explorer to see if there is something unusual about the file. That's when things became surreal.
When I navigated to the "promotion" directory, I found that there is no "mg_547" directory (and besides, what meaning could such a name have?). My understanding is that in an ASP.net WebForms application, URLs corresponding to files on a physical disk, but here, there is not file; there is no directory!
I checked that there isn't an "mg_547" virtual directory in IIS.
I carefully checked that there isn't an MVC controller hiding somewhere in the application and I reviewed the global.asax.cs file to see if there could be some unusual routing set up. I couldn't find anything that would explain what I'm seeing.
I decided that the text of the page must appear in my code base somewhere, so I selected some text from the page (being sure that it didn't contain HTML-encodings) and searched for the text in the code-base; no matches!
Therefore, as far as I can tell, it seems as if the IIS server is just making up this page with Satanic Black Magic!
I believe that I've found the answer. #EdSF's comment was very helpful.
There is a .net class called PageHandlerFactory which is overidden in the web application. Specifically, this class overrides the PageHandlerFactory.GetHandler method. The mg_547 directory name is parsed in this overridden method and maps the URL to a different file on disk.
As for the original trouble-ticket that started all of this, perhaps there could be a bug in this method that causes the 404 error.
This is just as I expected. This is a corner of ASP.net I've not yet become familiar with.

An error occurred on the server when processing the URL. Please contact the system administrator

When I tried to modify Microsoft forefront Unified access login.asp page and pages that comes with it ,
I prepared my custom files for css; inc files ; InstallAndDetect ..etc
but When i inserted those files under CustomUpdate folders i got this error :
" An error occurred on the server when processing the URL. Please contact the system administrator. "
I tried files i prepared before by putting them in the place of the default files propvided by the system.
Ofc the naming is respecting when using customupdate files!!
Do you have any idea how can I solve this issue??
I'm afraid I don't have a proper picture of what exactly might have caused the problem in your case.
But I just went through resolving the same error message on my system (2012 R2, IIS 8) (while searching for the solution I came across your post)
And it turned out that what was causing my problems was the use of classic ASP parent paths (with "../" in them)
Switching to absolute and virtual paths solved the issue for me.
See here: http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/classic-asp-parent-paths-are-disabled-by-default
Thank you for your answer.
Actually there was a bug with the product itself.
It didn't recognize the path to the CustomUpdate folder for any of custom folders in InternalSite folder.
I had to ask for a hot fix from Microsoft support to be able to use customized files (CSS , asp, images ).
Once the fix was installed, everything was working fine and I was able to see the customization I have done to the login page.

Unable to start debugging IIS 7.5 Detailed Error - 500.19

I tried to run my WebApp on my local machine today (nothing has changed on it) and I had the above error. I know my machine had a windows update recently (not sure if that has anything to do with it).
The error produces a big print out of css styles and html markup.
In the markup it also says "The requested page cannot be accecssed because the related configuration data for the page is invalid".
Maybe you accidentally changed the web.config and now contains a malformed section. I'd recommend you take a close look to your configuration file.
I'd say that the error page should tell you the necessary information to solve the problem but I assume that if you're asking if because it's not the case :)
I changed the user info. (windows password which was changed) in the IIS & that helped me :)
You may need to enable windows (or some other type of) authentication in IIS for the site specifically.

Possible bug/issue in ASP.NET 3.5 related to Request.RawUrl property

I posted a query for 301-redirect using ASP.NET 3.5 here:
Redirecting default.aspx to root virtual directory
Based on the replies I got there, I realized there might be a bug in ASP.NET's Request.RawUrl method which is unable to return the actual raw url (without /default.aspx) when being used in a sub-directory, i.e. the /default.aspx page is inside a subdirectory.
Can someone please shed some light on this possible bug?
Thanks,
Asif
i found a good explanation here
http://codeasp.net/blogs/vivek_iit/microsoft-net/873/301-redirect-from-default-aspx-to-site-root
Thanks
If you suspect this is a bug, then the place to go is Microsoft Connect, where you can report and discuss the bug directly with Microsoft.
Edit: I was able to reproduce the look per your comments.
I was unable to reproduce the infinite loop, however. I injected code into the Global.asax Application_BeginRequest handler of a web application and got the expected behavior of a single redirect.
There are other, and IMO much better, options for handling global redirect rules. On IIS7, I use the URL Rewrite module to configure rewrite rules in IIS. You can read more about it and download it here: http://www.iis.net/download/urlrewrite. The appeal of a solution such as this is that you can customize and update your rewrite rules without recompiling the application.
Edit: I was able to retrieve the raw URL without the default.aspx (after the redirect) by using instead:
Request.ServerVariables["CACHE_URL"]
It's worth a shot.
Have you looked at the IIS settings for your virtual directory? If there is a default document set to default.aspx then this will explain the infinite loop that you are experiencing. You are telling the website to redirect to the virtual directory without the "default.aspx" and IIS is detecting this on the next request and putting it back in ad infinitum.
Right click your virtual directory, select Properties and then the Documents tab. If default.aspx is in the list then that is what you will get. The Url of the request will be passed to the ASP.NET worker process as /folder/default.aspx rather than /folder/
This is not a bug. If IIS didn't do this, you would get a page not found error.
Sounds to me like you need to investigate URL rewriting: http://msdn.microsoft.com/en-us/library/ms972974.aspx

"The Resource Cannot Be Found: /Login.aspx" on new v5.20 Install

Please see my DNN Forum Post for more details.
I've never had any issues with DotNetNuke installations. But with the new v5.20 (or v5.02, whichever it really is), everything runs perfectly fine through installation. I then get to the main default portal homepage. But as soon as I click any of the links available to continue (Home, Register or Login) I get 404 errors every time with a reference back to the applicable aspx page (Home.aspx, Register.aspx or Login.aspx.).
Windows 7, IIS7, SQL Server 2008. All permissions are setup properly on the directory and in IIS. I would think this is an IIS7 configuration issue, but I've tweaked everything in there a half-dozen times. No one at DNN is returning answers on my forum post anymore either after one guy tried.
Help!
This is something to do with the Friendly URL stuff. I found this blog post which talks about the Friendly URL Provider architecture. This made me try changing the urlFormat attribute for the DNNFriendlyUrl provider from "humanfriendly" to "searchfriendly", which made the URLs the way they used to be. I'm not sure exactly where things are going wrong and don't really have time to dig into it at the moment, but hopefully this will be helpful to get you moving again too.
With the release of DNN5 (up until 5.02.01 as of the time of writing), the friendly URL provider won't work when DotNetNuke is not on default port 80. There are different solutions floating around, but the simplest is just to replace the DNN friendly URL provider with the free one from iFinity. The installation is really simple and included in the download. Or see the following blog post:
http://www.sailer.com.au/dotnetnuke/dnn5-friendlyurl-port
Okay have you tried the 'old style' of login - domain.com/default.aspx?ctl=login
If that still doesnt work then i have to say that most likely something has happened to IIS - if so then you might just see if you can install the package you have on a different box or have a friend try a different box
I have done 2 upgrades with 5.2 and a few test installs with the Starter Kit Package and Install packages and have never seen this problem - not to say that it doesnt exist.
My next trial would be to go and redownload the install package from CodePlex and start from scratch to see if you can make the same thing happen again.
OKayone thing I dont think that has been mentioned in reading through everything is double check IIS.
My first guess without looking on your server would be to check if something happened to the 'check file exists' setting - i know this is changed in IIS7 so I cant point to the exact place to check this.
Here is a link to the IIS7 forums on it - http://forums.iis.net/t/1092696.aspx
http://forums.asp.net/t/1191083.aspx
either one might help - google also has a lot on this
Tell me how this goes in checking up on it and we can move forward from there!
you probably need to reg_iis on the version(s) of asp.net that your IIS is going to support.
http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx
If the right version is not set up then you will get the 404 error
So placing it under port 80 works, right?
Is there a good reason not putting it under that port?

Resources