I have a fairly simple ASP.NET application, set up as a Web Application Project in Visual Studio. There is one particular aspx file called "invoice.aspx" which IIS refuses to serve. The URL I am using is definitely correct, and other aspx pages from this directory load and execute just fine. But not this ONE page! I've put a break point in Page_Load to make sure there is nothing funny going on, but the break point is never hit. The @Page directive looks fine... File permissions are the same as other files in the directory... no errors during build. What am I missing here? This is baffling me. This is IIS6 on a Windows XP dev box.
Sending on lots of data, long querystring or otherwise making a request that the built-in IIS7 urlscan might block? If IIS7 blocks a request, it'll send out a 404 error.
Have you tried renaming the file and trying to access that?
Also, use notepad to copy the entire contents of the file into a new file and save that one.
Well, I knew I'd find the answer myself if I posted about it... :)
It turned out to be a missing DLL. A dependent object could not be created and so it errored out. Why didn't it just give me a missingly assembly error? Ah, that is a good question! With the following bad code example answer:
public partial class Invoice : System.Web.UI.Page
{
DependentObject SomeObject = new DependentObject();
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
}
If the assembly for DependentObject's code is missing... the Invoice object, hence the Page to be served, cannot be initialized... the server can't find it... we have a 404.
I don't consider myself an expert in C#, but I am under the impression the above code is something you should never do. (right?) Not sure why the compiler allows it.
Moving the initial object creation to the Page_Load produces the much more useful missing assembly exception.
public partial class Invoice : System.Web.UI.Page
{
DependentObject SomeObject;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SomeObject = new DependentObject();
}
}
Thanks guys, appreciate the suggestions.