ASP ContentType 속성
ContentType 속성은 response 객체에 HTTP 콘텐츠 유형을 설정합니다.
문법:
response.ContentType[=contenttype]
파라미터 | 설명 |
---|---|
contenttype |
콘텐츠 유형을 설명하는 문자열. 전체적인 내용 유형 목록을 보려면, 브라우저 문서나 HTTP 규범을 참조하세요. |
예제
ASP 페이지가 ContentType 속성을 설정하지 않았다면, 기본적인 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>