garethtnash
asked on
If Recordset Null Response 404
Hello,
I have a page that returns results from a recordset..
I want the page to respond with 404 when no records are returned.
I've tried this ---
<% If ISNULL(descript) Then %>
<%
Response.Status = "404 Not Found"
%>
<%End if%>
But this is doing nothing??
I do have a web.config file with --
<httpErrors errorMode="DetailedLocalOn ly">
<remove statusCode='500' subStatusCode='100'/>
<error statusCode='500' subStatusCode='100' prefixLanguageFilePath='' path='/error/500.asp' responseMode='ExecuteURL'/ >
<remove statusCode='404' subStatusCode='-1'/>
<error statusCode='404' subStatusCode='-1' prefixLanguageFilePath='' path='/error/404.asp' responseMode='ExecuteURL'/ >
</httpErrors>
So once the 404 is returned, the site should send the user to the custom 404 page...
Clearly I'm doing something wrong, please advise.
Many thanks
I have a page that returns results from a recordset..
I want the page to respond with 404 when no records are returned.
I've tried this ---
<% If ISNULL(descript) Then %>
<%
Response.Status = "404 Not Found"
%>
<%End if%>
But this is doing nothing??
I do have a web.config file with --
<httpErrors errorMode="DetailedLocalOn
<remove statusCode='500' subStatusCode='100'/>
<error statusCode='500' subStatusCode='100' prefixLanguageFilePath='' path='/error/500.asp' responseMode='ExecuteURL'/
<remove statusCode='404' subStatusCode='-1'/>
<error statusCode='404' subStatusCode='-1' prefixLanguageFilePath='' path='/error/404.asp' responseMode='ExecuteURL'/
</httpErrors>
So once the 404 is returned, the site should send the user to the custom 404 page...
Clearly I'm doing something wrong, please advise.
Many thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, note that for the above code to work, the buffering must be on for the page.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks All
Response.Redirect(URL)
?