Licence Error - Root element is missing


#1

When licensing in the page code behind with the code below I get no errors.

sr = New StreamReader(Server.MapPath(".") & "\Aspose.Custom.lic")

licP = New Pdf.License

licP.SetLicense(sr.BaseStream)

I have a class which has its own instance of the Aspose.Pdf object and a property (to set the liceence from outside the class) When I pass StreamReader.BaseStream I receive the error: Root element is missing

Public WriteOnly Property AsposeLicence() As Stream

Set(ByVal Value As Stream)

mlic_Aspose_Licence_Word = New Aspose.Words.License

mlic_Aspose_Licence_Word.SetLicense(Value)

mlic_Aspose_Licence_Pdf = New Aspose.Pdf.License

mlic_Aspose_Licence_Pdf.SetLicense(Value)

End Set

End Property

I want to note the class with the above property is inside a dll (we are developing a project framework to be used in multiple projects).

STACK TRACE SNIPPET:

at System.Xml.XmlTextReaderImpl.Throw(Exception e)

at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)

at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

at System.Xml.XmlTextReaderImpl.Read()

at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

at System.Xml.XmlDocument.Load(XmlReader reader)

at System.Xml.XmlDocument.Load(Stream inStream)

at ߌ.ߒ.ߡ(Stream Ը)

at Aspose.Words.License.SetLicense(Stream stream)

at BKFramework.clsDocument.set_AsposeLicence(Stream Value) in C:\Inetpub\wwwroot\BKFramework\clsDocument.vb:line 200


#2

Hi,

Thank you for considering Aspose.

Please try setting the Position of the stream to 0.