【问题标题】:What's The Equilavent of PHP code: header() in Asp.Net?什么是 PHP 代码的等价物:Asp.Net 中的 header()?
【发布时间】:2012-04-15 12:20:21
【问题描述】:

我有一个从 XML 文件加载数据的 flash 文件。
在遇到重新加载数据的问题后,我找到了用 PHP 代码编写 XML 代码到屏幕的解决方案。
这是我使用的代码:

<?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>';
?>  

我想在 Asp.Net aspx 页面中使用相同的技能。我发现 Response.Write() 等同于 echo 函数,但是如何将 header() 函数转换为 Asp.Net 代码?
提前致谢。

【问题讨论】:

    标签: php asp.net flash


    【解决方案1】:
    HttpContext.Current.Response.Headers.Add
    
    HttpContext.Current.Response.AddHeader
    

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-26
        • 2012-06-03
        • 2020-12-08
        • 2019-08-14
        • 1970-01-01
        相关资源
        最近更新 更多