473,795 Members | 2,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom HTTP Error Code Handling

windows_mss
13 New Member
<customErrors defaultRedirect ="ErrorPage.asp x" mode="On">
<error statusCode="500 " redirect="500.a spx" />
<error statusCode="404 " redirect="404.a spx" />
<error statusCode="403 " redirect="403.a spx" />
</customErrors>
I Used the above code to Handle the HTTP Error Code, My Problem Is as follows,

This My Program URL http://localhost/Work/CustErr/Default.aspx,

When I alter The URL Like This http://localhost/Work/CustErr/Default2.aspx, I Can Able To Get The 404 Error, For Page Not Found,

When I Try This url http://localhost/Senthil/Work/CustErr/Default.asp Or http://localhost/Work/Custrr/Default.aspx both of the url are 404 error,

but my program not caching this one, Default IE Page Cannot Found Page is Displaying In The Browser, how can i over come this problem,

Need Help,

Thanks In Advance
Mar 14 '07 #1
1 2819
eagle63
1 New Member
When I alter The URL Like This http://localhost/Work/CustErr/Default2.aspx, I Can Able To Get The 404 Error, For Page Not Found,

When I Try This url http://localhost/Senthil/Work/CustErr/Default.asp Or http://localhost/Work/Custrr/Default.aspx both of the url are 404 error,

but my program not caching this one, Default IE Page Cannot Found Page is Displaying In The Browser, how can i over come this problem,
The short answer for fixing your problem is that you need to set the custom 404 error page for your website in the IIS configuration. It needs to point to the same location you have configured in the web.config file.

Go in to IIS settings (in MMC). Open the websites folder. Right-click on your website. Choose the Custom Errors tab. Select the 404 Error Message from the list and choose Edit Properties. In the File field enter the local path of your custom ASPX error page.

If you want to understand why, read on.

Your settings in the web.config file only affect files that are mapped to the aspnet_isapi.dl l in IIS. So when you type in a broken URL in your browser that ends with .aspx the IIS server passes that request on to the aspnet_isapi.dl l. It's this .Net handler that determines that the file is missing (404) and then, according to the web.config settings you posted, forwards to the custom error page.

Now lets look at the second broken link you mentioned. The URL has a .asp extension. By default IIS maps .asp files to a different handler (asp.dll). So your broken URL request is passed to the asp.dll to handle the request. The asp.dll finds the same problem (the resource is missing). However, your web.config settings do not affect the asp.dll handler and so your request does not get forwarded to your custom ASP.Net error handler. So, not having any custom settings in place asp.dll passes the 404 error back to IIS. IIS looks at its configuration for custom 404 errors and forwards you to the generic 404 page.

That last broken link has a .aspx extension. So you would think that IIS would handle it with the aspnet_asapi.dl l handler. It should then be forwarding to your configured custom 404 page. However, the catch here is that you have changed the directory name (Custrr) so IIS will first check for the directory to see what the custom Application Mappings are for that directory. Since the directory does not exist IIS goes directly to its own custom 404 page. So it never gets to the aspnet_asapi.dl l.

This isn't an IE problem. However, if your IE is configured to "Show friendly HTTP error messages" it may be adding to the confusion.
Apr 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2290
by: Sean Mullaly | last post by:
I have a custom Access menu with sub-menus and sub-sub-menus. (220 items). Right now I have created 220 Functions and attached each individual Function to the specific OnAction property. The Functions return Text which is the same as the Caption of the sub-sub-menu items. I would like to reference the Custom Popup Caption of these sub-sub-menus and pass it through one Function for input in a form. *** Sent via Developersdex...
1
1807
by: Mukund Patel | last post by:
Hi friends, I have implemented custom error handling at page level and application level. If there is any syntax error in my aspx class file it will redirect to error page when I run the page. But if any syntax error in my component class (Code dir) it will not redirect to my custom error page. Is there any way that will redirect to my custome error page in case of all type of compile time error and runt time error anywhere in my...
3
2060
by: Mr Newbie | last post by:
I'm testing error handling configurations and having some trouble. I created a WebForm called. ErrDefault.aspx and I am trying to use the Page error attribute to force the redirection to a custom page, but I only get and unhandled exception page and it does not direct me to my specific page. I'm probably doing something really stupid, but I cant see what . Any Ideas ? - Thanx Mr N --------- DETAILS BELOW -----------
15
2722
by: bill salkin | last post by:
I'd like to create a custom error handler like this in VB.NET: .... try ... Throw ("Lender Name not in table") .... catch ("Lender Name not in table")
6
1589
by: Steve Amey | last post by:
Hi all I want to be able to throw a custom error up the call stack. I have looked around and it seems as though it's possible, but I can't get it to work :o( Below is some sample code. ------------------------------------------------------------ Public Class MainForm Public Sub Show Form Try
1
1514
by: serge calderara | last post by:
dear all, i am a bit confused on the way custom error are handling and occurs. First of all I have understand that customer error is used to defined more user friendly message to my end user and that custom errors mask out more details error if the web side is access from the local web server browser right ? If it is so I have read that setting the mode attribute to OFF in web.config
3
3407
by: matko | last post by:
This is a long one, so I'll summarize: 1. What are your opinions on raising an exception within the constructor of a (custom) exception? 2. How do -you- validate arguments in your own exception constructors? I've noticed that, f.ex., ArgumentException accepts null arguments without raising ArgumentNullException. Obviously, if nothing is to be supplied to the exception constructor, the default constructor should
5
7226
by: jegec | last post by:
Hi all! Brief subject: I have to develop an ASP-based application, and build also a specific error handling ASP. After that I had set the virtual directory Custom Error 500;100 to new ASP - and now I have no error handling at all. Even if I reset it to Default! Detailed description:
2
19494
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9672
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
9519
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
10215
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...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
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
6783
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
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.