📜  ASP ContentType 属性

📅  最后修改于: 2022-05-13 01:56:35.979000             🧑  作者: Mango

ASP ContentType 属性

ASP ContentType 属性用于设置响应标头对象的 HTTP 内容类型/子类型。默认值为文本/HTML

句法:

response.ContentType[=contenttype] 

参数值:它包含字符串值,即contentType ,它表示内容类型。

示例 1:此示例说明了 asp 页面具有的各种类型的内容。

HTML
<%response.ContentType="text/HTML"%>
<%response.ContentType="image/GIF"%>
<%response.ContentType="image/JPEG"%>
<%response.ContentType="text/plain"%>


HTML
<%response.ContentType="application/vnd.ms-excel"%>
 
  
    
     
           
           
           
           
     
     
           
           
           
          
     
    
GeeksforGeeksSudo
CPHPNodeCSS
  


示例 2:如果安装了 Excel,此示例代码将在浏览器中生成 2 X 4 Excel 电子表格。

HTML

<%response.ContentType="application/vnd.ms-excel"%>
 
  
    
     
           
           
           
           
     
     
           
           
           
          
     
    
GeeksforGeeksSudo
CPHPNodeCSS
  

输出: