473,385 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Response.Status, force 404 return from ASP

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?
Aug 24 '05 #1
3 11642
http://aspfaq.com/show.asp?id=2162

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Lucvdv" <re**********@null.net> wrote in message
news:4i********************************@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?

Aug 24 '05 #2
On Wed, 24 Aug 2005 10:29:55 +0100, "Steven Burn"
<so*******@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.
Aug 24 '05 #3
> 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"
Aug 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike C | last post by:
First of all, I am a complete newbie to Python, but have been impressed with how easy the language has been to pick up. I am trying to write a script that checks to see if the web / application...
5
by: Kevin Jackson | last post by:
If I have something like this... if Count > 0 Response.Status = "400" else Response.Status = "200" end if The status is always set to 400 even if count is zero...
8
by: Jazzis | last post by:
If I want to execute an ASP page and get NOTHING in return, no HTL Headers as well? response.clear clears only the contents, but HTML Header is still returned. Thanks for your time. Adam
4
by: Chris Fink | last post by:
How do I retrieve the HTTP Status code (ie 202, 404, etc) below? I am currently receiving the response text but unable to access the response status code. string strNewValue; string...
3
by: Lars Netzel | last post by:
I want to press a Linkbutton (in a DatagridItem) and return a file that is not shared in the IIS. I want to disallow "deeplinking". The following code works fine (it sends the file I want) but I...
2
by: balakrishnan.dinesh | last post by:
Hi frends & collins, The code below is the one Im using now for xmlhttp request in IE as well as Netscape browser.I have put this code in a server,if i want to retrive the data from the same...
2
by: wugon.net | last post by:
env: db2 LUW v8 + aix We encounter some java applications status did not change and keep in "Federated request pending" for a long time. we try issue db2 "force applications <handle id>" to...
3
by: Odd Bjørn Andersen | last post by:
Is there a way to check the return status from a stored procedure when called from a OS (Windows) script? I have a stored procedure that does some checking in the database, and the return status...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.