473,395 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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="404page.aspx.cs"
AutoEventWireup="false" Inherits="mydomain._404page" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.SessionState" %>

<html>

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

void Page_Load(Object sender, EventArgs e) {
Response.Redirect("~/default.aspx");
}

</script>

<head>
<title>404page</title>
<meta name="CODE_LANGUAGE" 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="404page.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 1603
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*********************@f14g2000cwb.googlegro ups.com...
Hi,

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

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

<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.SessionState" %>

<html>

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

void Page_Load(Object sender, EventArgs e) {
Response.Redirect("~/default.aspx");
}

</script>

<head>
<title>404page</title>
<meta name="CODE_LANGUAGE" 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="404page.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
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...
4
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...
3
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...
2
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...
0
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...
8
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...
5
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...
1
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...
3
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.