Asp 로 개발된 Web Site 에서 발생한 문제.

링크를 통한 excel다운로드 기능이 구현된 asp 파일을 불러오는데,

파일명을 지정되지 않아 발생한 문제

 

Excel 다운로드시 Asp File Name 으로 파일이 다운로드 되는 현상.

 

 

 

//수정 전 코드
<% 
	filename = "recruit_list"
    Response.Buffer = TRUE
    Response.ContentType = "application/vnd.ms-excel"
    Response.AddHeader "Content-Disposition","attachment; filename="&filename&".xls"
 %>
 
 <%
 	~~ DB Data part
    
 %>
 
 <html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
</head>
<body>
<h3>현황</h3>
<TABLE cellspacing="0" cellpadding="0" border="1" bordercolor="#222222" style="font-family:'돋움';  overflow:auto; word-break: break-all; width:100%; font-size:11px ">
<TR align=center height=70>
	<TD bgcolor=#FFD9B3><b>NO</TD>
	<TD bgcolor=#FFD9B3><b>성 명</TD>
	<TD bgcolor=#FFD9B3><b>생년월일</TD>
	<TD bgcolor=#FFD9B3><b>나이</TD>
	<TD bgcolor=#FFD9B3><b>비고</TD>
</TR>

 

//수정 후 코드
<% 
  Dim filename  : filename = "recruit_list"
  Response.Buffer = TRUE
  Response.AddHeader "Content-Disposition","attachment;filename=" & filename & ".xls" '한글 인코딩 깨지지 않게 보존
  Response.ContentType = "application/vnd.ms-excel"
 %>
 
 <%
 	~~ DB Data part
    
 %>
 
 <html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
</head>
<body>
<h3>현황</h3>
<TABLE cellspacing="0" cellpadding="0" border="1" bordercolor="#222222" style="font-family:'돋움';  overflow:auto; word-break: break-all; width:100%; font-size:11px ">
<TR align=center height=70>
	<TD bgcolor=#FFD9B3><b>NO</TD>
	<TD bgcolor=#FFD9B3><b>성 명</TD>
	<TD bgcolor=#FFD9B3><b>생년월일</TD>
	<TD bgcolor=#FFD9B3><b>나이</TD>
	<TD bgcolor=#FFD9B3><b>비고</TD>
</TR>

 

의외로 간단히 해결됩니다....

모르는 상태에서.. IIS MIME 까지 확인해보기도하고.. 삽질을 많이했네요..

 

구글링 하니 한글폰트 깨지는 문제에 대해서는 많은 글들이 있던데.. 저와같은 유형은 없어서 ...

SMALL

+ Recent posts