خاصية ContentType لـ ASP

response Object Reference Manual

يحدد خاصية ContentType HTTP نوع المحتوى الذي يتم إرساله من قبل objResponse.

النحو:

response.ContentType[=contenttype]
المتغيرات الوصف
contenttype

السلسلة التي توضح نوع المحتوى.

للحصول على قائمة شاملة من أنواع المحتوى، يرجى الرجوع إلى وثائق متصفحك أو معيار HTTP.

مثال

إذا لم يتم تعيين خاصية ContentType في صفحة ASP، فإن رأس content-type الافتراضي يكون كالتالي:

content-type:text/html

بعض القيم الشائعة لـ ContentType:

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

هذا المثال سينفذ جدولاً إلكترونياً من نوع 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>

response Object Reference Manual