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.
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).
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.
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.
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.
HttpContext.Current.Response.Headers.Add
HttpContext.Current.Response.AddHeader
You can use Response.ContentType for the content type and you can also look into Response.Cache.SetExpires for expiring the cache immediately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With