There is no problem in importing excel on godddy, but system. Security. securityexception is prompted when exporting excel.
Solution steps:
1. To the http://nopcommerce.codeplex.com/download nopce-ce-a6bd30c10ba3.zip, This is the version I downloaded.
2. decompress the package and find epplus. dll in the nopcommerce_a6bd30c10ba3 \ SRC \ packages \ epplus.2.9.0.1 \ Lib \ 2.0 folder.
3. Put epplus. dll in the bin folder of your project, or add reference
4. Usage:
using System;using System.IO;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using Maticsoft.DBUtility;using OfficeOpenXml;protected void Export(){ FileInfo newFile = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "/Download/Download.xls"); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "/Download/Download.xls")) { File.Delete(AppDomain.CurrentDomain.BaseDirectory + "/Download/Download.xls"); } using (ExcelPackage xlPackage = new ExcelPackage(newFile)) { ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add("SheetName"); worksheet.Cells[1, 1].Value = "a1"; worksheet.Cells[1, 2].Value = "b1"; worksheet.Cells[2, 1].Value = "a2"; worksheet.Cells[2, 2].Value = "b2"; xlPackage.Save(); }}
Here, only the files are saved to the server and are not automatically downloaded. If you need to download them automatically, you need to handle it yourself. I use the URL to download the files, please let me know how to automatically bring up the download prompt dialog box. Thank you.