473,624 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.Transfer not working from Application_err or for 404 events

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.transfer s from the applicaiton_err or 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_err or on a 404 error?

Jan 24 '06 #1
6 2045
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.goo glegroups.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.transfer s from the applicaiton_err or 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_err or on a 404 error?

Jan 24 '06 #2
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_err or 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_err or 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
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.transfer s from the applicaiton_err or 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_err or on a 404 error?

Jan 24 '06 #4
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_err or 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
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_err or 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
Thank you for this information.

Mar 21 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6860
by: Kris Meher | last post by:
Hi My code Global.asax Application_Start() { // Code // There is possibility of Exception in above Code }
4
4112
by: VK | last post by:
Hello, I am trying to get the last occured error via the following code: Sub Page_Load(...) Dim zero As Integer = 0 Try Dim err As Integer = 10 / zero Catch ex As Exception
0
1148
by: Greg | last post by:
Why would I get this suddenly now that I am running in VS 2005: System.NullReferenceException was unhandled by user code Message="Object reference not set to an instance of an object." Source="System.Web" StackTrace: at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at VPM.Global.Application_Error(Object sender, EventArgs e) in C:\Inetpub\wwwroot\VPM\App_Code\Global.asax.vb:line 104
0
987
by: Larry | last post by:
Here's an interesting one. This happens only in the asp.net server that is launched from VS.Net 2005. In IIS it does not occur. We placed a server.transfer call in our global.asax's Application_Error. When an unhandled exception occurs, this works fine. However, we are seeing that on every page request (under asp.net development server debug mode), that after the ProcessRequest for the desired page, the Application_Error fires as...
4
2170
by: David Lozzi | last post by:
Howdy, I found a nice little book called ASP.NET 2.0 Cookbook by Michael A Kittel and Geoffrey LeBlond. Anyway, they have some instructions on how to setup application level error handling. Most of my functions have try..catch to email me about an error, then I want the application level to fire off to send the user to a custom page AND log it in the app log. When an error occurs on my page, i get a server error Server Error in...
2
6944
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
1
2181
by: David Thielen | last post by:
Hi; If an exception is thrown in the global.asax Application_Start then calling HttpApplication.Server.Transfer throws an exception. How can I tell from the HttpApplication object if it is ok to call Transfer? -- thanks - dave david_at_windward_dot_net
6
2180
by: n# | last post by:
A Basic Question in ASP.NEt 1.1 In Page_Load Event I am doing a Server.Transfer. But it throws an error on the browser windows showing "Server Application Not Found" Pls help me
5
2607
by: vishalgupta | last post by:
i have void Application_Error(object sender, EventArgs e) { Server.Transfer("default.aspx"); } in global.asax now when i use any state bags like Session = "new"; whenever the user clicks on link to a page that does not exist on the server, Application_Error() executes but Server.Transfer does not and it shows that the page cannot be found and does not transfer to default.aspx.
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8619
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.