By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,245 Members | 1,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,245 IT Pros & Developers. It's quick & easy.

Server.Transfer not working from Application_error for 404 events

P: n/a
I am trying to remove dependence on the frameworks custom error
mechanisms to get a site to work with google sitemaps, because they
framework does a redirect 302 to the errorpage.

Instead I am doing server.transfers from the applicaiton_error event.
This seems to work fine except for in the case of 404 errors. Is there
any way to do a server.transfer from application_error on a 404 error?

Jan 24 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
a 404 is file not found. iis is returning this, not asp.net. you would need
an isapi filter, or asp.net module with all file extensions mapped to the
asp.net (unless you only need to catch 404 on *.aspx).

-- bruce (sqlwork.com)

<je******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am trying to remove dependence on the frameworks custom error
mechanisms to get a site to work with google sitemaps, because they
framework does a redirect 302 to the errorpage.

Instead I am doing server.transfers from the applicaiton_error event.
This seems to work fine except for in the case of 404 errors. Is there
any way to do a server.transfer from application_error on a 404 error?

Jan 24 '06 #2

P: n/a
I have already handled the case using iis for the file extensions that
are not handled by asp.net. These pages are configured through iis.

I am looking at the specific case of .aspx files because those requests
are directed to asp.net whether or not the page exists. And in that
case I need to do a Server.Transfer in my application_error function so
that asp.net does not do a redirect ( 302 ) first. I have to do this
to comply with google sitemaps. Apparently, there is no way to do this
..net for a 404 error in the application_error function. I know there
is probably a work around by creating a module that checks for files.
I was hoping that someone found a way to make this work without
resorting to that.

Jan 24 '06 #3

P: n/a
If you only need to catch the 404 in .aspx, then why can't you set up a
custom 404 page in IIS that's an aspx page and handle it there?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"je******@yahoo.com" wrote:
I am trying to remove dependence on the frameworks custom error
mechanisms to get a site to work with google sitemaps, because they
framework does a redirect 302 to the errorpage.

Instead I am doing server.transfers from the applicaiton_error event.
This seems to work fine except for in the case of 404 errors. Is there
any way to do a server.transfer from application_error on a 404 error?

Jan 24 '06 #4

P: n/a
I am already doing that. BUT, for requests of .aspx extensions they
are not handled by iis. They are handled by the asp.net worker
process, so when a user or webcrawler requests foo.aspx it is routed to
the worker process whether it exists or not. Then mapHttpHandler
throws an exception. At this point iis is already out of the picture
so you have to either use asp.net's built in custom error facilities,
which don't work for my purpose because of the fact they do a redirect
or you have to do a server.transfer from application_error which
doesn't seem to be working because there is no context.

If there is some way to have iis handle a request for foo.aspx that
doesn't exist before or after the worker process handles it I am all
ears. Any suggestions?

Jan 24 '06 #5

P: n/a
I believe you can get IIS to handle the 404 on *.aspx via custom error page
settings by checking the "Check that file Exists" checkbox under your .aspx
ISAPI Mapping setting (IIS Site Properties - Home Configuration - ISAPI
Extensions - .aspx properties)

"je******@yahoo.com" wrote:
I am already doing that. BUT, for requests of .aspx extensions they
are not handled by iis. They are handled by the asp.net worker
process, so when a user or webcrawler requests foo.aspx it is routed to
the worker process whether it exists or not. Then mapHttpHandler
throws an exception. At this point iis is already out of the picture
so you have to either use asp.net's built in custom error facilities,
which don't work for my purpose because of the fact they do a redirect
or you have to do a server.transfer from application_error which
doesn't seem to be working because there is no context.

If there is some way to have iis handle a request for foo.aspx that
doesn't exist before or after the worker process handles it I am all
ears. Any suggestions?

Mar 4 '06 #6

P: n/a
Thank you for this information.

Mar 21 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.