public dynamic GetExcelExport([FromUri] string filter, [FromUri] string sort, [FromUri] int view)
        {
            HajClassLib.DevelopmentConfiguration.DeveloperUserImperosnate();

            HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);

            result.Content = new StringContent(DirectoryItemServices.GetCSVDirectory(sort ?? string.Empty, filter ?? string.Empty, (DirectoryItemServices.directoryViewType)view, Services.Security.CurrentUserAllowMobile()));
            result.Content.Headers.ContentType                 = new MediaTypeHeaderValue("application/octet-stream");
            result.Content.Headers.ContentDisposition          = new ContentDispositionHeaderValue("attachment");
            result.Content.Headers.ContentDisposition.FileName = "directory.csv";
            return(result);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string attachment = "attachment; filename=Directory.csv";

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ClearHeaders();
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.AddHeader("content-disposition", attachment);
            HttpContext.Current.Response.ContentType = "text/csv";
            HttpContext.Current.Response.AddHeader("Pragma", "public");

            if (Page.IsPostBack)
            {
            }
            else
            {
                HttpContext.Current.Response.Write(DirectoryItemServices.GetCSVDirectory("", "", DirectoryItemServices.directoryViewType.All));
            }

            HttpContext.Current.Response.End();
        }