Intercept IIS 404 errors? Issue with Viewstate and 404

J

Jonathan Folland

I have been working on this most of the day and cannot find a solution to my
problem.

I have an application where I may not actually have a page. for example a
user may make a request for www.mydomain.com/page_that_does_not_exist.aspx.

In the Application_BeginRequest, I am handling that by remapping the path to
www.mydomain.com/index.aspx?page=page_that_does_not_exist

The index.aspx page is smart enough to know to load a control named
"page_that_does_not_exist" into a placeholder.

So, everything works great, but then I want to implement a custom 404
handler. I am implementing the custom 404 handler to give to search engine
web bots. The problem that I now face is that my call to
www.mydomain.com/page_that_does_not_exist.aspx now generates the 404 error
.... even when I am doing a post back. Somehow or another the 404 error is
clearing the view state for drop down lists (not for text box controls)
only. The result is that many pieces of my application no longer work
correctly, as long as I am implementing the custom 404 handler. I want to
be able to intercept a 404 before it is generated to determine if it is
truly a 404.

Any ideas about how to intercept and repress 404s that are not truely 404s
for my application?
 
J

Jonathan Folland

One option that I have thought of is to completely disable 404 handling for
ASPX.

If a request is for ASPX, then I can determnine if there is a page not found
and re-route accordingly. I would still prefer to have an automatic page
not found for any junk file requested.

Again, any ideas.

Jonathan
 
J

Jonathan Folland

I found the answer.

The 404 was being generated by a missing GIF file. I thought it was
generated by the architecture of the application. All I had to do was place
the missing gif and the problem was resolved.

J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top