ASP.NET Web Form 다양한 방법이 있겠지만 주로 Handler(.ashx)를 사용하여 구현함 Default.aspx Default.aspx.cs protected void btnDownload_Click(object sender, EventArgs e) { Response.Redirect("PathToHttpHandler/FileDownload.ashx"); } FileDownload.ashx public class FileDownload : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpResponse response = context.Response; string fileName = "텍스트 파일.txt"; str..
ASP.NET MVC5에서 View로 데이터를 전달하는 방법에 대해서 정리해 보았다. ViewData ViewBag ViewModel ViewData ViewData는 dictionary 타입인 ViewDataDictionary로부터 파생됨 ViewData는 current request 동안에만 유효함. redirection 이 발생하면 초기화됨 ViewData는 사용하기 전에 type cast가 필수 StudentController.cs public ActionResult Index() { IList studentList = new List(); studentList.Add(new Student(){ StudentName = "Jiwoo" }); studentList.Add(new Student(){ ..
Route A route is a URL pattern that is mapped to a handler. The handler can be a physical file, such as an .aspx file in a Web Forms application. A handler can also be a class that processes the request, such as a controller in an MVC application. To define a route, you create an instance of the Route class by specifying the URL pattern, the handler, and optionally a name for the route. referenc..
Word 문서 HTML로 변환하기 1. OpenXml 활용 .docx 파일만 변환 가능 .docx 파일은 Open Office XML(OOXML) 구조를 사용 좀 더 자세하게 설명하자면 내부적으로 xml 파일들로 구성되어 있고 이를 ZIP형식으로 압축하여 저장함 .docx 파일의 내부 구조가 궁금하다면 확장자를 .zip으로 변경 후 압축 해제하면 볼 수 있다. OpenXml 관련 라이브러리 추가 Document.Format.OpenXml OpenXmlPowerTools --> 이 라이브러리를 추가하면 Document.Format.OpenXml도 같이 추가됨 이미지가 포함되어 있지 않은 Word문서 변환 Code byte[] byteArray = File.ReadAllBytes("Test.docx"); u..
이번 포스팅에서는 Docker 컨테이너에 ASP.NET Web API Application을 배포하는 방법에 대해 써보려고 합니다.운영체제 및 사전 준비 환경OS는 Windows 7 64bit (Docker를 사용하시려면 64bit 운영체제는 필수입니다) BIOS 설정에서 PC CPU 가상화 지원 기능 Enabled로 변경 Window용 Docker Toolbox 설치 (Git은 꼭 설치되어야 합니다)만약 Docker를 처음 접하시는 분들이라면 이 동영상을 보시면 많은 도움이 될 것 같습니다~ Docker Toolbox 둘러보기Toolbox 설치를 완료하면 아래 3가지 아이콘이 보이게됩니다. (Docker Quickstart Terminal, Oracle VM VirtualBox, Kitematic(Al..
이번 포스팅에서는 ASP.NET Web API를 만들어 보도록 하겠습니다.Project 생성저는 Visual Studio 2017 Community 버전을 사용하고 있습니다.마이크로소프트에서 제공하고 있는 ASP.NET Tutorial을 바탕으로 Web API프로젝트를 구성하겠습니다.파일 > 새로만들기 > 프로젝트템플릿 중 ASP.NET Core 웹 응용 프로그램 (.NET Core) 선택ASP.NET Core 버전은 1.1 선택Web API 선택솔루션 탐색기에 MVC형태 비슷하게(Models 폴더 추가가 필요함) 프로젝트 구성이 되어 있는 것을 확인 후 Ctrl + Shift + B 솔루션 전체 빌드솔루션 밑에 생성된 프로젝트를 시작 프로젝트로 설정 후 Ctrl + F5로 디버깅 없이 시작IIS Exp..
웹 페이지 내에서 특정 부분만 업데이트를 하기 위해 비동기 호출을 사용했었는데 그 때 사용했던 방법에 대해 정리해보려고 합니다.Jquery AJAX Call Microsoft Ajax 서버 컨트롤 사용Jquery AJAX CalljQuery.ajax() API를 사용하면 비동기 호출을 사용할 수 있다. (jquery 1.5 보다 높은 버전을 쓰는 것이 좋을 것 같다. 1.5에서 많은 기능이 추가된 듯…)Jquery 추가 Jquery로 WebMethod 호출$.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "CompanyList.aspx/GetCompanyList", data: '{"com..