1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class gadmin_download_download: System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e ) { string path = Server.MapPath( "." ); string filename = HttpUtility.UrlDecode( Request.QueryString[ "strFile" ] ); string endcode_filename = string.Empty; if( Page.Request.UserAgent.IndexOf( "NT 5.0" ) >= 0 ) { endcode_filename = Server.UrlEncode( filename ); } else { endcode_filename = HttpUtility.UrlEncode( filename, new UTF8Encoding() ).Replace( "+", "%20" ); } Response.AddHeader( "Content-Disposition", "attachment;filename=" + endcode_filename ); Response.ContentType = "application/octet-stream"; Response.HeaderEncoding = Encoding.GetEncoding( "utf-8" ); Response.WriteFile( path + @"\" + filename ); } } | cs |
'개발' 카테고리의 다른 글
[javascript] 기간종료 (0) | 2014.06.05 |
---|---|
[.net] 기간종료, 이벤트 종료 (0) | 2014.06.05 |
[java] 현재 페이지의 url 주소 가져오기 (1) | 2014.04.22 |
[java] JSTL core:forEach varStatus (0) | 2014.04.13 |
[java] ip request.getRemoteAddr() 결과값이 0:0:0:0:0:0:0:1 로 나오는 경우 (0) | 2014.04.09 |