خاصية ASP ContentType
استكمال مرجع كائن الاستجابة
تعيّن الخاصية ContentType نوع محتوى HTTP لكائن الاستجابة.
بناء الجملة
response.ContentType[=contenttype]
Parameter | Description |
---|---|
contenttype | A string describing the content type.
For a full list of content types, see your browser documentation or the HTTP specification. |
أمثلة
إذا لم يتم تعيين خاصية ContentType لصفحة ASP ، فسيكون رأس نوع المحتوى الافتراضي:
content-type:text/html
بعض قيم ContentType الشائعة الأخرى:
<%response.ContentType="text/HTML"%>
<%response.ContentType="image/GIF"%>
<%response.ContentType="image/JPEG"%>
<%response.ContentType="text/plain"%>
سيفتح هذا المثال جدول بيانات Excel في مستعرض (إذا كان المستخدم لديه برنامج Excel مثبتًا):
<%response.ContentType="application/vnd.ms-excel"%>
<html>
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
</table>
</body>
</html>
استكمال مرجع كائن الاستجابة