License rights

Hi,

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)


Regards,
Arjan S.

I don’t think it’s a license problem. If you remove the first two line of code, I think this problem still will occur.

Could you please post your aspx page and source code here? I will check what caused your problem.

Here is the source:

.aspx page:

<%@ Page Language=“vb” AutoEventWireup=“false” Codebehind=“prgenerate-xls.aspx.vb” Src=“prgenerate-xls.aspx.vb” Inherits=".updateproductinfo_prgeneratexls" %>
<%@ Page Language=“vb” AutoEventWireup=“false” Codebehind=“prgenerate-xls.aspx.vb” Src=“prgenerate-xls.aspx.vb” Inherits=".updateproductinfo_prgeneratexls" %>

.aspx.vb page:

<%@ Page Language=“vb” AutoEventWireup=“false” Codebehind=“prgenerate-xls.aspx.vb” Src=“prgenerate-xls.aspx.vb” Inherits=".updateproductinfo_prgeneratexls" %>Imports System
Imports System.Web
Imports Microsoft.VisualBasic
Imports Aspose.Excel

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

End Class

The attached file is my test code and it works fine.

Hi,

Sorry for late reply due to holiday.

I’ve tried your source code, but it still gives the same error.


Regards,
Arjan S.

Hi,

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

Source File: D:\2server-inet2\wwwroot\Reseller\extranet\supplier\products\prgenerate-xls.aspx.vb Line: 17

Stack Trace:

[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

Source File: D:\2server-inet2\wwwroot\Reseller\extranet\supplier\products\prgenerate-xls.aspx.vb Line: 17

Stack Trace:

[UnauthorizedAccessException: Access to the path “C:\WINNT\system32\xxxxxx.xls” is denied.] System.IO.__Error.WinIOError(Int32 errorCode, String str) +393 System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888 System.IO.FileStream…ctor(String path, FileMode mode) +52 Aspose.Excel.Worksheets.?(String ?, SaveType ?, FileFormatType ?, HttpResponse ?) +358 [Exception: Errors in Excel Save method:0] Aspose.Excel.Worksheets.?(UInt32 ?, Exception ?) +365 Aspose.Excel.Worksheets.?(String ?, SaveType ?, FileFormatType ?, HttpResponse ?) +1009 Aspose.Excel.Excel.Save(String fileName, SaveType saveType, FileFormatType fileFormatType, HttpResponse response) +341 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 

What happens if you change your code to:

xls.Save(“xxxxxx.xls”, SaveType.OpenInExcel, FileFormatType.Excel97, Response) ?

Could you please post your license file here? Thanks.

Well, then I get a ‘cannot find server or DNS’ error…

Laurence wrote:
Could you please post your license file here? Thanks.


File is sent via pm...

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.

Hi,

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.

(PM = private message)

Regards,
Arjan S.


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.


The SaveType is specified as SaveType.OpenInExcel:

Private Sub CreateDocument()
Dim license As New Aspose.Excel.License
license.SetLicense(Server.MapPath("/_server/license/Aspose.Excel.lic.xml"))

xls = New Aspose.Excel.Excel
ws = xls.Worksheets.Item(0)
CreateContent()
xls.Save(“pr.xls”, SaveType.OpenInExcel, FileFormatType.Excel97, Response)
xls = Nothing
End Sub


I didn't find your problem whether the port is 80 or 90. Maybe it's a VB bug. Could you please try the following code:


xls.Save("xxxxxx.xls", Aspose.Excel.SaveType.OpenInExcel, Aspose.Excel.FileFormatType.Excel97, Response)