Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding custom header with classic asp

Tags:

asp-classic

I was wondering if its possible to add custom header with classic asp. In other words, I am looking for classic asp equivalent of .net's Response.AddHeader().

i.e.
HttpContext.Response.AddHeader("customheadertruefalse","1");

like image 966
zurna Avatar asked Mar 15 '10 01:03

zurna


People also ask

Is it possible to add custom header?

In the Add Custom HTTP Response Header dialog box, set the name and value for your custom header, and then click OK.

How do I add a header in Web API?

Adding Custom Header for Individual Response We create a very basic HTTP GET endpoint. Within this endpoint, we access the Response object through the HttpContext object. Then, we add a new header, with the name of x-my-custom-header and a value of individual response .

How do I add a request header?

To add custom headers to an HTTP request object, use the AddHeader() method. You can use this method multiple times to add multiple headers. For example: oRequest = RequestBuilder:Build('GET', oURI) :AddHeader('MyCustomHeaderName','MyCustomHeaderValue') :AddHeader('MySecondHeader','MySecondHeaderValue') :Request.

What is response AddHeader in asp net?

The AddHeader method adds a new HTML header and value to the response sent to the client. It does not replace an existing header of the same name. After a header has been added, it cannot be removed.


2 Answers

Use Response.AddHeader (as JohnFx already answered). Here is sample from one of my working asp pages :

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=ranking-export.csv"
like image 112
Edelcom Avatar answered Nov 27 '22 14:11

Edelcom


Don't mean to be that guy, but have you tried Response.AddHeader?

like image 33
JohnFx Avatar answered Nov 27 '22 12:11

JohnFx