Filename should not contain path


I am using the following save method

myExcel.Save(System.Web.HttpContext.Current.Server.MapPath(".") + @"\docs" + sFileName, Aspose.Excel.SaveType.OpenInExcel, Aspose.Excel.FileFormatType.Default, System.Web.HttpContext.Current.Response);

How come I can not save the file in a different location? As in the current DIR does not have write access.

Also what are the required permissions on the web server side? The reason I ask is because everything works fine for the imports on my dev machine but on production all excel sheets are empty. Even the template headers dont come across or worksheet names.

Could this be caused by a firewall? The files come across at 0bytes. Sometimes they come across larger but if you try and open you get “not enough memory” or “unable to read file” errors. We are using a Cisco PIX Firewall.

Oh the website is also SSL.

I’ve also noticed that the excel docs only come out corrupt when I choose OpenInExcel. If I save to the HD then user clicks on link its fine.

Here is the full code I am using to make .xls

public void ExportToExcel(DataTable dtData, string sStartCell, string sFileName, string sWorkSheetName)


Aspose.Excel.Excel myExcel = new Aspose.Excel.Excel();

Aspose.Excel.Worksheet myWorkSheet = myExcel.Worksheets[0];

myWorkSheet.Name = sWorkSheetName;

Aspose.Excel.Cells myCells = myWorkSheet.Cells;

myCells.ImportDataTable(dtData, true, sStartCell);

myExcel.Save(sFileName, Aspose.Excel.SaveType.OpenInExcel, Aspose.Excel.FileFormatType.Default, System.Web.HttpContext.Current.Response);



If you want to save the file on disk, please try this:


Do you use http compression on your website? If yes, I think that caused the problem.

If not, it may be caused by the firewall.

You can test it by this method.

FileStream fs1 = new FileStream("d:\\book1.xls", FileMode.Open, FileAccess.Read);
byte[] data1 = new byte[fs1.Length];
fs1.Read(data1, 0, data1.Length);

this.Response.ContentType = "application/xls";
Response.AddHeader( "content-disposition","inline; filename=book1.xls");

With above code, you can try to read an Excel file and send to client browser without Aspose.Excel. That will help you to figure out what's the problem in web server settings.

Maybe you also need to check the IE setting since you use https.


Thanks alot! It was Http compression. I made an exception for that aspx file and it worked like a charm.



Hi Marmot,
I am using http compression on my live server and facing the same problem as you faced previously. Can you please give some instructions on how to you solve the problem? How to make http compression exception for that specified aspx file? Thanks in advance.