Welcome to WebmasterWorld Guest from 23.22.182.29

Forum Moderators: ocean10000

Message Too Old, No Replies

404 Errors

404 error with asp

     
9:34 am on Feb 19, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Jan 18, 2005
posts:208
votes: 0


How do you create 404 errors with asp?
1:35 pm on Feb 19, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 5, 2005
posts:123
votes: 0


if you mean how to handle 404 errors, here's a method:
IIS -> site -> properties -> custom error -> 404 -> edit properties.
Here you can make setting like:
Message Type: URL
URL: /directoryname/404.asp

This will execute your directoryname/404.asp when there is invalid URL request. You can do your coding in your 404.asp. Invalid url string is available by request.ServerVariables("QUERY_STRING")

1:38 pm on Feb 21, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 19, 2002
posts:3171
votes: 8


don't think that was what was meant.

how do you return a 404 from within an asp page

eg. pseudo code

IF [i don't want you to look at my page condition] TRUE THEN
return 404 to the browser
ELSE
return content
END IF

currently i'm doing this by response.redirect to a non existant page which fires a 404 error,

but i'm sure there is a better and more elegant way.

2:00 pm on Feb 21, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 22, 2003
posts:116
votes: 0


Could you be looking for this:
<%
Response.Status = "404 Not Found"
%>
2:17 pm on Feb 21, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 19, 2002
posts:3171
votes: 8


that does it for me!