Response.Status, force 404 return from ASP

L

Lucvdv

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?
 
L

Lucvdv


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.
 
A

Aaron Bertrand [SQL Server MVP]

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top