homepage Welcome to WebmasterWorld Guest from 54.211.181.45
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
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
cmatcme

5+ Year Member



 
Msg#: 2504 posted 9:34 am on Feb 19, 2005 (gmt 0)

How do you create 404 errors with asp?

 

Jalinder

5+ Year Member



 
Msg#: 2504 posted 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")

topr8

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



 
Msg#: 2504 posted 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
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

10+ Year Member



 
Msg#: 2504 posted 2:00 pm on Feb 21, 2005 (gmt 0)

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

topr8

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



 
Msg#: 2504 posted 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