Free Support Forum - aspose.com

Support request from nbeher at 9/20/2007 8:44:45 PM

Received : 2007/09/20 20:44:45
Message : Can the MachineKey files that are generated by aspose.word be deleted?

Is there a way to delete these files automatically? Currently there are about 900,000 files in the MachineKey folder that I want to get rid of.

Any help will be appreciated.


This message was posted using Aspose.Live 2 Forum

Hi

Thanks for your request. These files are keys to use for encryption and decryption of forms authentication cookie data and view state data, and for verification of out-of-process session state identification. I think that Aspose.Words doesn’t generate these files but your application generates these keys.

Also try to reconfigure your application. See MSDN for more information.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfmachinekeysection.asp

Best regards.

Every time Aspose.word is invoked, two sets of new keys are generated in the “machinekey” folder.
Shoudn’t Aspose be using just one pair of keys as other .net programs use? Why is it necessary to generate two pair of new keys everytime?

It is causing this folder and inturn the disk drive to fill-up over time.

Hi

It is very strange. Aspose.Words does not create any keys in “MachineKeys” folder on my side. Please, explain me how can I reproduce this.

Best regards.

Please refer to the following link that mentions the key pair being generated by .Net in the "machineKey" folder when aspose tries to verify the license file. Can this mechanism of Apspose be looked into, so the Aspose uses its own public/private keys to circumvent the crypto providers key generation?

http://www.aspose.com/wiki/default.aspx/Aspose.Corporate/HowToFixCSPException.html

Aspose.Word tries to verify a digital signature on a license file and instantiates a .NET crypto provider. There is a behaviour (maybe a bug) in .NET in that the crypto provider always generates a key pair in its constructor. This is very inefficient behavior from .NET because Aspose.Word does not need a new key since it has a public key that it will use to verify the license, but nothing can be done to avoid the crypto provider generating a key every time.

The key pair created by the crypto provider is normally stored in a user profile, but an ASP.NET application usually runs under the ASPNET user account and this account does not have a user profile loaded. Therefore Aspose.Word instructs the crypto provider to store the key in the machine-wide key storage (recommended by Microsoft in this situation for any ASP.NET application).

For the .NET crypto provider to be able to store the key in the machine-wide, the above mentioned folder MachineKeys folder must exist and the ASPNET account must have permissions to write to it.

Please note this requirement is not specified to Aspose.Word, it is general for any ASP.NET application trying to use encryption algorithms provided by .NET that employ public/private key pairs.

Hi

Thanks for additional information. I think that you should call SetLicense from the Global.asax.cs (Global.asax.vb) file, in the Application_Start protected method. I hope this will solve your problem. See the following link for more information.

http://www.aspose.com/Products/Aspose.Words/Api/WhentoApplyaLicense.html

Best regards.