Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's The Equilavent of PHP code: header() in Asp.Net?

Tags:

php

flash

asp.net

I have a flash file that is loading data from XML file.
After I had a problem of reloading data, I found a solution to write XML code to screen with PHP code.
Here's the code I use:

<?php
header ("Cache-Control: no-cache, must-revalidate");
header ("Content-Type:text/xml");
echo '<images>';
echo '<image title="1" src="Images/01.jpg" description="1"/>';
echo '<image title="2" src="Images/02.jpg" description="2"/>';
echo '<image title="3" src="Images/03.jpg" description="3"/>';
echo '<image title="4" src="Images/04.jpg" description="4"/>';
echo '<image title="5" src="Images/05.jpg" description="5"/>';
echo '</images>';
?>  

I want to use same skill in Asp.Net aspx page. I found Response.Write() as an equilavent to echo function but how can I convert header() functions to Asp.Net code?
Thanks in advance.

like image 444
kubilay Avatar asked Apr 01 '12 16:04

kubilay


People also ask

What does header () do in PHP?

The header() function in PHP sends a raw HTTP header to a client or browser. Before HTML, XML, JSON, or other output is given to a browser or client, the server sends raw data as header information with the request (particularly HTTP Request).

How can I get header in PHP?

The get_headers() function in PHP is used to fetch all the headers sent by the server in the response of an HTTP request. Parameters: This function accepts three parameters as mentioned above and described below: $url: It is a mandatory parameter of type string. It defines the target URL.

Which function is used in PHP to include header file in a page?

PHP | header() Function The PHP header() function send a HTTP header to a client or browser in raw form. Before HTML, XML, JSON or other output has been sent to a browser or client, a raw data is sent with request (especially HTTP Request) made by the server as header information.

What is content type header in PHP?

The Content-Type header is used to indicate the media type of the resource. The media type is a string sent along with the file indicating the format of the file. For example, for image file its media type will be like image/png or image/jpg, etc. In response, it tells about the type of returned content, to the client.


2 Answers

HttpContext.Current.Response.Headers.Add

HttpContext.Current.Response.AddHeader
like image 159
Peter Aron Zentai Avatar answered Dec 03 '22 05:12

Peter Aron Zentai


You can use Response.ContentType for the content type and you can also look into Response.Cache.SetExpires for expiring the cache immediately.

like image 39
Rob Lauer Avatar answered Dec 03 '22 05:12

Rob Lauer