Welcome to WebmasterWorld Guest from 54.196.233.239

Forum Moderators: ocean10000

Message Too Old, No Replies

404 Errors

404 error with asp

     

cmatcme

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

10+ Year Member



How do you create 404 errors with asp?

Jalinder

1:35 pm on Feb 19, 2005 (gmt 0)

10+ Year Member



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")

topr8

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

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



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.

fabfurs

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

10+ Year Member



Could you be looking for this:
<%
Response.Status = "404 Not Found"
%>

topr8

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

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



that does it for me!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month