We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

License Question initializing in my ASAX Session On Start

I have a license and I placed in my ASAX file on the Session On Start:

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)

' Code that runs when a new session is started

Dim license As Aspose.Cells.License = New Aspose.Cells.License()

'Pass only the name of the license file embedded in the assembly

license.SetLicense("Aspose.Cells.lic")

End Sub

Then in my bin I placed the lic file. It works fine on my local but when I do a publish the evaluation keeps coming up when I moved it to my web server. I don't see my ASAX file when doing a publish but not sure if that compiles with the code. Also the lic file did not get into my bin when I did the publish I had to add it to it after the publish was completed. However it is in my solution in the bin folder.

Hi,

Thanks for sharing the details.

Well, when you publish a website through VS.NET, the license file (.lic extension) is not copied to the publishing (destination) folder.Also, when you publish the web project, only the complied version of the Global.asax file is copied to the /bin bolder in your destination folder. I think you may try some options, e.g..,

  • Try to modify the extension of the license file, e.g.., open the Aspose.Cells.lic file into notepad and save it as "Aspose.Cells.txt", mind you, never change the content of the file.
  • Put it into your project's /bin folder.
  • In your Session_Start() event, change the code accordingly, as follows:

'Code that runs when a new session is started

Dim license As Aspose.Cells.License = New Aspose.Cells.License()
'Pass only the name of the license file embedded in the assembly
license.SetLicense("Aspose.Cells.txt")

  • Now, publish the website.

Thank you.

it is still not working, I was looking to add it as a embedded resource by right clicking the file but I don’t see that option. The solution is just a web site in .Net 2.0 and not a web project so not sure how I embed it. I need to get this running ASAP.

Since it works fine in your local dev machine, this must be a deployment problem. It seems that the Session_Start event isn’t fired because Aspose.Cells will throw an exception if our program cannot find the license file.