C#基础之Response.ContentType响应内容类型[通俗易懂]

3、设置响应内容类型改为json类型,效果如下

 
 

Response.ContentType

1、文本格式:html、xml、txt

Response.ContentType = “text/html “;

Response.ContentType = “text/xml”;

Response.ContentType = “text/plain”;

2、图片格式

Response.ContentType = “image/jpg”;

Response.ContentType = “image/png”;

Response.ContentType = “image/gif”;

3、媒体格式

Response.ContentType = “application/json”; //比较常用

Response.ContentType = “application/xml”;

Response.ContentType = “application/xhtml+xml”;

Response.ContentType = “application/atom+xml”;

Response.ContentType = “application/pdf”;

Response.ContentType = “application/msword”;

Response.ContentType = “application/octet-steam”;

Response.ContentType = “application/x-www-form-urlencoded”;

posted @ 2023-08-02 16:19  herry507  阅读(615)  评论(0编辑  收藏  举报