How can I answer a “204 No Content” http response with classic ASP ?
When I simply send an empty response with the following code :
Response.Clear
Response.End
I style get an answer on the client-side. IE9 open a window with an empty (but valide) html file.
I just need to know how to properly return a 204 from an ASP page.
204 isn’t an error. It’s an indication of a successful request, but simply without a response. (Think of it like the HTTP equivalent of the
voidreturn type for a method.)Are you sending a 204 to your client? From the code shown I would guess what you’re actually sending is a 200 response with no content, which is not the same thing. If that’s the case, the web browser is behaving correctly by displaying the (lack of) content being returned.
Edit: Re-reading your question, are you asking how to properly return a 204 from an ASP page? It wasn’t clear at first. If that’s the case, take a look at the Response object. Specifically, for the
Statusproperty:In this case, try: