473,944 Members | 25,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a custom 404 asp.net page.

Hi,

I'm going nuts with a supposed simple thing.
I have this page :

<%@ Page language="c#" Codebehind="404 page.aspx.cs"
AutoEventWireup ="false" Inherits="mydom ain._404page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<%@ Import Namespace="Syst em.Web" %>
<%@ Import Namespace="Syst em.Web.SessionS tate" %>

<html>

<script language="C#" runat="server">

void Page_Load(Objec t sender, EventArgs e) {
Response.Redire ct("~/default.aspx");
}

</script>

<head>
<title>404pag e</title>
<meta name="CODE_LANG UAGE" Content="C#">

</head>
<body>

</body>
</html>
All what I want is to redirect any error to the root.
I already added : <error statusCode="404 " redirect="404pa ge.aspx" /> to
the web.config.

The problem is, when a page is mistyped, I am sending to the error
page, but the error page is not redirecting to the root as it should !
What's the problem ?

Thanks in advance.

Nov 19 '05 #1
1 1636
If what you want to do is redirect to /default.aspx,
why don't you do it directly, instead of first redirecting
to 404.aspx and then redirecting again to /default,aspx ?

<error statusCode="404 " redirect="/default.aspx" />

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

<cr************ @hotmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
Hi,

I'm going nuts with a supposed simple thing.
I have this page :

<%@ Page language="c#" Codebehind="404 page.aspx.cs"
AutoEventWireup ="false" Inherits="mydom ain._404page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<%@ Import Namespace="Syst em.Web" %>
<%@ Import Namespace="Syst em.Web.SessionS tate" %>

<html>

<script language="C#" runat="server">

void Page_Load(Objec t sender, EventArgs e) {
Response.Redire ct("~/default.aspx");
}

</script>

<head>
<title>404pag e</title>
<meta name="CODE_LANG UAGE" Content="C#">

</head>
<body>

</body>
</html>
All what I want is to redirect any error to the root.
I already added : <error statusCode="404 " redirect="404pa ge.aspx" /> to
the web.config.

The problem is, when a page is mistyped, I am sending to the error
page, but the error page is not redirecting to the root as it should !
What's the problem ?

Thanks in advance.

Nov 19 '05 #2

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

Similar topics

2
9731
by: PK | last post by:
Hello, I am looking for help on the following. I'm trying to create a custom browser toolbar button that will do a few things. One that I'm trying to do at the moment is just simply return the URL of whatever page the user is visiting. I wanted to create a Win32 application using VB.NET. If there is a better way of doing this please let me know. I assume there needs to be some sort of client side code. I was originally leaning...
4
7417
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is there are multiple pages per invoice. How can I grab the data, make the TIF, place it on the client and then Open with the clients default program for veiwing TIF's (usually Microsoft Picture and Fax Viewer). Please help.
3
1953
by: Kyle Fitzgerald | last post by:
I've started a web control library project and can build my own controls to add to the toolbox in the .NET environment. The problem I'm having is I want to create a control just like the HTML table where I could drag my control on the page and then drag and drop other controls into the cells of the table. I've tried creating my own and I tried to inherit from system.ui.htmlcontrols.htmltable but I can not get it to have the borders and...
2
1172
by: Buddy Ackerman | last post by:
I want to dynamically create page links that my customers can click on and get the appropriate data but the pages don't really exist. Is there any other way to do this other than creating a custom 404 error page?
0
2146
by: Ravi Ambros Wallau | last post by:
Hi: I've created a custom control - a grid that uses Infragistics to display some filters, the grid itself, and some buttons. Well, when using this control directly on WebForm, everything works really fine. No problems at all. But, when this control is placed inside a template of an Infragistics UltraWebTab control, somethings stranges happens: 1. When the WebForm is opened, an "Error Creating Control" message is displayed (for container...
8
2128
by: Ravi Ambros Wallau | last post by:
Hey guys: What can I do when an "Error Creating Control" is displayed on the form (instead of the control), and a tooltip indicating the error never is displayed? Is there some log, some hidden message, some entry in registry where a log is created (or that enables a log, trace, dump or whatever)... I'm a little bit frustated with this error :-( Tks, Ravi.
5
2311
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a collection object -- say, a dictionary. Populating that collection object with custom objects, say, Person. What I really want to see is how to populate the properties of those Person objects from a datasource: instantiate one Person, fill...
1
11727
by: WebMatrix | last post by:
Hi, I started a new web application which so far has several grdiviews displaying data. I find myself reimplementing the same logic (copy/pasting really) in grid's event ItemDataBound and RowCreated and Sorting events to add certain effects. For example inserting sorting direction image to the column header. I want to create one custom grid view that implement all this logic to be reused through out this app, so I wont need to copy...
3
4025
by: Allan Ebdrup | last post by:
I get the error "Error creating control: ID property is not specified" when I view my custom web control in design view. I add the control that gives an error in OnInit like this: ----- foreach (WizardStep ws in WizardSteps) { CustomWizardStepHeader header = new CustomWizardStepHeader(); header.ID = "CustomWizardStepHeader"; ws.Controls.AddAt(0, header); }
3
1943
by: =?Utf-8?B?R2hpc3Rvcw==?= | last post by:
Hi all, We have a N-Tier framework and we now create a Web Site App to wotk with this architecture. I add reference from my libraries in the project and creating page and controls is very easy, using my objects. But, it's seem that I cannot create report using Crystal Report with my objects. I created classes in the app_Code folder and yes, I can use them but, it's not the way I eant to do it. I want to use my classes from my dlls.
0
10147
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
9973
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,...
1
11310
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,...
0
9870
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
8238
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
7399
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
6315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4924
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
2
4519
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.