homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

404 Errors
404 error with asp

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

How do you create 404 errors with asp?



 1:35 pm on Feb 19, 2005 (gmt 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)

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
return content

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)

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


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

that does it for me!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved