I have a aspose.excel enterprise 1 developer license, purchased november 2004 and upgrade to the new format in februari 2005.
I am using it on 1 website now (on a development server and a live server). Now I want to use it on another website on the same development server and same live server. However, if I load the page which references the aspose.excel object, I get a ‘page cannot be displayed’ error. If I remove the xls.save line then I don’t get an error.
It seems the component does not allow me to use the component on more then one website. But I think I should be able to do that, considering the license rights of the component.
Am I doing something wrong here?
Dim license As New Aspose.Excel.License license.SetLicense(Server.MapPath("/_server/license/Aspose.Excel.lic.xml")) xls = New Aspose.Excel.Excel xls.Save(“pr.xls”, SaveType.OpenInExcel, FileFormatType.Excel97, Me.Response)
Public Class updateproductinfo_prgeneratexls Inherits System.Web.UI.Page
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
CreateDocument()
End Sub
Public Sub CreateDocument() Dim license As New Aspose.Excel.License license.SetLicense(Server.MapPath("/_server/license/Aspose.Excel.lic.xml")) Dim xls As Aspose.Excel.Excel xls = New Aspose.Excel.Excel xls.Save(“pr.xls”, SaveType.OpenInExcel, FileFormatType.Excel97, Response) xls = Nothing End Sub
I changed the parameters of the save function a bit and now I get this error. Could it be a problem with a Temp directory or something like that?
Regards, Arjan S.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 15: Dim xls As Aspose.Excel.Excel Line 16: xls = New Aspose.Excel.Excel Line 17: xls.Save("xxxxxx.xls", SaveType.Default, FileFormatType.Default, Response) Line 18: xls = Nothing Line 19: End Sub
[NullReferenceException: Object reference not set to an instance of an object.] Aspose.Excel.Worksheets.a(String A_0, SaveType A_1, FileFormatType A_2, HttpResponse A_3) +511 [Exception: Access denied because you do not have enough permissions, or another user has the file open and locked.] Aspose.Excel.Worksheets.a(UInt32 A_0, Exception A_1) +148 Aspose.Excel.Worksheets.a(String A_0, SaveType A_1, FileFormatType A_2, HttpResponse A_3) +1315 Aspose.Excel.Excel.Save(String fileName, SaveType saveType, FileFormatType fileFormatType, HttpResponse response) +309 prxls.CreateDocument() in D:\2server-inet2\wwwroot\Reseller\extranet\supplier\products\prgenerate-xls.aspx.vb:17 prxls.Page_Init(Object sender, EventArgs e) in D:\2server-inet2\wwwroot\Reseller\extranet\supplier\products\prgenerate-xls.aspx.vb:8 System.Web.UI.Control.OnInit(EventArgs e) +67 System.Web.UI.Control.InitRecursive(Control namingContainer) +241 System.Web.UI.Page.ProcessRequestMain() +194
After upgrading to the latest 3.2.0.0 version of Aspose.Excel, I get a more detailed error. I have no idea why it is trying to save/access the file in the system32 directory while I am sending it to the Response object (unless it is trying to make a temp file somewhere…?).
Server Error in ‘/’ Application.
Access to the path “C:\WINNT\system32\xxxxxx.xls” is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path “C:\WINNT\system32\xxxxxx.xls” is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose “Properties” and select the Security tab. Click “Add” to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 15: Dim xls As Aspose.Excel.Excel Line 16: xls = New Aspose.Excel.Excel Line 17: xls.Save(“xxxxxx.xls”, SaveType.Default, FileFormatType.Excel97, Response) Line 18: xls = Nothing Line 19: End Sub
Really a strange problem. Maybe your IIS is not confiured correctly. Could you please try to install Aspose.Excel.msi in your machine and see if the demos work in your machine?
Your license file is sent via pm. What does pm mean? Thank you.
I have found the cause of the problem: the website I was working on ran on port 90 because of shortage of ip adresses in my network. When I changed this to port 80 it worked again.
After finding the solution for the development server, I now run into the same problem (aspose.excel trying to save the file in system32 folder) on the production webserver. However, this server is running on the default port (80), so that can't be it.
The only thing non-standard is that it is a website running on a subdomain (so instead of
www.xxx.com
it runs on zzz.xxx.com).
It seems that the Save function tries to determine whether to save to a file or stream to the response object, and that it fails to determine this correctly. When the port is non-default it fails and also under other circumstances. I have no idea what the problem is this time… please help
How do you specify the SaveType? If you use SaveType.Default, Aspose.Excel saves file to local disk, so your problem occurs. Please use SaveType.OpenInExcel or SaveType.OpenInBrowser option.