Response.ContentType과 Response.AddHeader( "Content-Type", "..." )의 차이가 무엇일까요? ^^
IIS 5.0(Windows 2000)에서의 ASP 코드에서 위와 같은 코드는 분명히 차이가 존재합니다.
예를 들어 다음과 같이 코딩을 했을 경우,
Response.AddHeader("Content-Type", "application/octet-stream")
출력되는 헤더는 다음과 같이 구성이 됩니다.
HTTP/1.1 200 OK
Date: Thu, 13 Apr 2006 01:29:02 GMT
Content-Length: 2332
Content-Type: Application/octet-stream
Content-Type: text/html
위의 코드에 대해서 GetHeader("Content-Type")을 하게 되면, "Application/octet-stream, text/html"이라고 나오게 됩니다.
결국, 정상적으로 Content-Type을 구성하기 위해서는 AddHeader를 주어서는 안 되고, Response.ContentType 속성을 사용해야 한다는 것입니다.
[참고로, 이 현상은 IIS 6.0(Windows 2003)에서는 발생하지 않습니다. 아마도 ASP 3.0 엔진에서는 위와 같은 경우에 대해서 하나만 나오도록 수정한 듯 보입니다.]