Home > Archive > ASP > August 2005 > Response.Status, force 404 return from ASP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Response.Status, force 404 return from ASP
|
|
| Lucvdv 2005-08-24, 7:55 am |
| I want to return a 404 response from an ASP script (IIS 5).
Response.Status lets me set the response string, but if I don't include any
HTML text myself, the result is an empty page.
Is there a way to 'redirect' it to the server's default 404 response, as if
the URI really doesn't exist, but without really redirecting it so the URL
isn't replaced in the browser's address bar?
| |
| Steven Burn 2005-08-24, 7:55 am |
| http://aspfaq.com/show.asp?id=2162
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"Lucvdv" <replace_name@null.net> wrote in message
news:4icog15jlm3b4rqajsvnn6n24fa81t37k9@
4ax.com...
> I want to return a 404 response from an ASP script (IIS 5).
>
> Response.Status lets me set the response string, but if I don't include
any
> HTML text myself, the result is an empty page.
>
> Is there a way to 'redirect' it to the server's default 404 response, as
if
> the URI really doesn't exist, but without really redirecting it so the URL
> isn't replaced in the browser's address bar?
| |
| Lucvdv 2005-08-24, 7:55 am |
| On Wed, 24 Aug 2005 10:29:55 +0100, "Steven Burn"
<somewhere@in-time.invalid> wrote:
> http://aspfaq.com/show.asp?id=2162
Sorry if I wasn't clear, but that's the opposite of what I was looking for.
I have an ASP already processing the request, so there is no real 404
condition.
The page is used only to accept POST requests (if all is OK, it sends back
nothing but a "204 No Data" status code; errors result in something else).
What I want is to simulate (or force) a standard 404 if the request is not
accepted (someone trying to 'GET' it, or faking a POST request without
knowing exactly what to put in).
In the end, the ASP is not supposed to be called from a browser at all.
At the other end there's an application POST-ing information that the ASP
stores in a database, that's all.
FWIW, the application is part of an automated update system for unattended
machines spread all over the country. This part checks free disk space and
some other parameters, and posts the info to a central location where
alerts are triggered if maintenance seems necessary somewhere.
Generating the 404 isn't important to the system's workings, I just wanted
to present prying eyes with a clear "there's nothing here for you" sign
that can't be distinguished from *really* hitting a 404 on the same server.
| |
| Aaron Bertrand [SQL Server MVP] 2005-08-24, 7:55 am |
| > Is there a way to 'redirect' it to the server's default 404 response, as
> if
> the URI really doesn't exist, but without really redirecting it so the URL
> isn't replaced in the browser's address bar?
Well, you could try server.transfer "/404url.asp"
|
|
|
|
|