Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 16th, 2007, 06:54 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom HTTP 404 Problem w/ASP to ASP.NET

Custom HTTP 404 Problem w/ASP to ASP.NET

Our old site used ASP, and our new site uses ASP.NET to display XML data using an XSLT transformation. I've just set up a custom 404 page for the new site. If I enter a test URL to test the redirect, this is how it works:

1) If I enter http://www.mysite.com/http404.aspx, the custom 404 page loads properly.
2) If I enter http://www.mysite.com/yadayada.aspx, which doesn't exist, I get redirected to the custom 404 page.
3) If I enter http://www.mysite.com/yadayada.asp, which doesn't exist, I do not get redirected to the custom 404 page. Instead, I get an error message:
XML Parsing Error: not well-formed
Location: http://www.mysite.com/yadayada.asp
Line Number 1, Column 2:<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" EnableSessionState="false" EnableViewState="false" title="HTTP 404" %>
-^

I checked to make sure that all of the documents are well-formed, so I'm not sure why this is happening. If anyone could let me know what is causing this, I'd really appreciate it. Thanks.

KWilliams
  #2 (permalink)  
Old November 16th, 2007, 07:42 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Where and how did you tell your web server where to go on a 404 for classic ASP pages?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old November 19th, 2007, 11:07 AM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the site's properties in IIS under the "Custom Error's tab, he has our custom 404 page listed like this:
HTTP Error=404
Type=File
Contents=C:\Itenpub\wwwroot\mysite\http404.aspx

KWilliams
  #4 (permalink)  
Old November 19th, 2007, 11:16 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

That's what I thought.

With Type=File, the contents of the file are served as is; that is; the file is read from disk and sent to the browser.

You want to set it URL and then set the contents to something like /http404.aspx

If you want to share the same file with multiple sites, put it in a shared folder, map that in each site as a Virtual Directory like CustomErrors and then set the URL to /CustomErrors/http404.apsx

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #5 (permalink)  
Old November 21st, 2007, 03:50 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

My Network Administrator tried your suggestion but it didn't work. This error occurred: "The specified request cannot be executed from current Application Pool".

He also tried the solution found at http://www.outsystems.net/DeveloperC...x?TopicId=1791 and http://technet.microsoft.com/en-us/l...78092.aspx#EJD, but that just caused the same "application pool" error. He said that the site uses a .NET 2.0 directory and is set to use a .NET 2.0 pool. Another thing I noticed is that any page with any other extension besides .aspx don't work (i.e. .asp, .htm, .html, etc.). So I'm completely stumped as to why this is happening. Any other suggestions would be greatly appreciated. Thanks.

KWilliams
  #6 (permalink)  
Old November 21st, 2007, 04:39 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

How did you map the ASPX file to your web site? You need to configure it as a Virtual Folder and map it to the 404 URL.

We have custom ASP error handlers running like that and they work fine....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #7 (permalink)  
Old November 26th, 2007, 03:56 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

My Network Admin. says that he did exactly what you suggested, but it didn't work. This is what he said when I forwarded the instructions from your last post:

"The main directory's folder is a Virtual Folder, and of course your custom 404 file is in the root of that directory. The server is IIS 6 / Windows 2003."

Do you see any clues to what we're doing wrong in what he said?

He uses a test-version of my site for testing purposes these kinds of things, which is in a cirtual fol

KWilliams
  #8 (permalink)  
Old November 26th, 2007, 04:17 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Try this on your local IIS and see if it works for you (worked for me).

1. Create a folder C:\Site

2. Create a folder C:\Errors

3. Create a new web site with its root pointing to C:\Site

4. Create a new Virtual Directory called Errors under this site pointing to C:\Errors

5. In C:\Errors create an ASP file called 404.asp with the code:

Response.Write(Request.QueryString)

6. Configure IIS to have 404 map to the URL /Errors/404.asp

7. Request http://localhost/DoesNotExist.asp

8. You should get the Response.Write statement from the 404 page

ASPX errors won't be triggered like this and instead rely on ASP.NET handling by default.

HtH,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with HTTP Headers in servlet vs ASP javajed Servlets 3 November 15th, 2011 03:47 AM
HTTP Error 404 Problem in ASP.NET kwilliams ASP.NET 2.0 Basics 2 August 7th, 2006 03:18 PM
Consuming web services in asp.net using http post dpk100 .NET Web Services 1 May 4th, 2005 02:03 AM



All times are GMT -4. The time now is 06:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.