简体   繁体   中英

What's The Equilavent of PHP code: header() in 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.

HttpContext.Current.Response.Headers.Add

HttpContext.Current.Response.AddHeader

您可以对内容类型使用Response.ContentType ,也可以查看Response.Cache .SetExpires以立即使缓存过期。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM