/// <summary> /// 下载文件 /// </summary> /// <param name="context"></param> public void Download(HttpContext context) { if (!RequestProxry.VerifyLogin(context)) { return; } string url = context.Request["url"]; string filePath = AppDomain.CurrentDomain.BaseDirectory + url; if (!File.Exists(filePath)) { context.Response.Write("资源不存在"); return; } string fileName = Regex.Match(url, "(\\\\|/)(([^\\\\/]+)\\.(.+))$").Groups[2].Value; context.Response.AppendHeader("Content-Type", ""); context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName); const int bufferSize = 100; byte[] buffer = new byte[bufferSize]; int readSize = -1; using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { while (readSize != 0) { readSize = fs.Read(buffer, 0, bufferSize); context.Response.BinaryWrite(buffer); } } }
public void Export_ProcessExport(HttpContext context) { if (!RequestProxry.VerifyLogin(context)) { return; } ExportHandle.ProcessExport(context); }
/// <summary> /// 导出 /// </summary> /// <param name="context"></param> /// <returns></returns> public string Export_Setup(HttpContext context) { if (!RequestProxry.VerifyLogin(context)) { return(null); } TemplatePage page = Cms.Plugins.GetPage <Main>("mg/export_setup.html"); page.AddVariable("page", new PageVariable()); page.AddVariable("export", new { setup = ExportHandle.Setup(context.Request["portal"]) }); return(page.ToString()); }
public string Export_Import(HttpContext context) { if (!RequestProxry.VerifyLogin(context)) { return(null); } TemplatePage page = Cms.Plugins.GetPage <Main>("admin/export_import.html"); page.AddVariable("page", new PageVariable()); page.AddVariable("case", new { json = new object() }); return(page.ToString()); }