 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

November 16th, 2007, 06:54 PM
|
Banned
|
|
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 19th, 2007, 11:07 AM
|
Banned
|
|
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 19th, 2007, 11:16 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|

November 21st, 2007, 03:50 PM
|
Banned
|
|
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 21st, 2007, 04:39 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|

November 26th, 2007, 03:56 PM
|
Banned
|
|
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 26th, 2007, 04:17 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |