Free Support Forum - groupdocs.com

SetLicense permissions for GroupDocs Viewer

Hey,

I’m trying to use the SetLicense method to set the license of the GroupDocs Viewer with the path of the file, e.g.:

License lic = new License();
lic.SetLicense(“GroupDocs.Viewer.lic”);

(The license is in the same folder as the binaries).

It fails with access is denied exception: System.UnauthorizedAccessException: Access to the path ‘<actual_path_here>\GroupDocs.Viewer.lic’ is denied.

Only when I gave the user WRITE permissions on the file it worked,
Why would it need to have WRITE permissions? why isn’t READ permission enough?
Any chance to fix it or have some other way of only reading it?

Thanks.

Hi there,


Thanks for using GroupDocs.Viewer for .NET.

In case your license file is located in a read only folder, please try to apply the license using the following code.

using (FileStream fileStream = new FileStream(licensePath, FileMode.Open, FileAccess.Read))
{
License lic = new License();
lic.SetLicense(fileStream);
}

Try the above code and share your feedback with us.

Have a nice weekend ahead.
Warm Regards

Thank you for your reply,

Instead of new FileStream I used File.OpenRead, which worked after figuring out the correct MapPath I needed to use.

Nevertheless, I think fixing the SetLicense(string) WRITE permissions should be fixed, no reason for it to need a WRITE permission.

Thank you.

Hi there,


Its good to hear that your issue has resolved. We’ll surely look into it.

Have a nice weekend ahead.
Warm Regards