I am using Aspose.PDF 6.9 in an ASP.NET web application to convert a web page to a PDF file. The application uses a WebRequest object to obtain the HTML, then I use BindHTML to create the PDF. The code works the first time it runs, but all subsquent attempts throw a NullReferenceException when I use the BindHTML method. If I stop the application and start it again, the code works the first time then throws NullReferenceExceptions.
The error I receive is below.
Object reference not set to an instance of an object. <?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>
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:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set
to an instance of an object.]
I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-33685. We will investigate this
issue in details and will keep you updated on the status of a correction.
I have tested the scenario using current release version of Aspose.Pdf for .NET 7.7.0 and I am unable to notice any issue. The problem seems to be fixed due to recent fixes introduced in product. Can you please try using the new release version and in case you still face the same issue or you have any further query, please feel free to contact.
We have further investigated the issue reported earlier and during our testing with latest release of Aspose.Pdf for .NET 9.6.0, the problem seems to be fixed. Please try using following code snippet and in case you still face any issue, please feel free to contact.