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

Free Support Forum - aspose.com

Error 500 on PDF.BindHTMLFromUrl


When i use this code on aspx page :

string surl = http://mysite.com/default.aspx";

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();


pdf.Save("Test.pdf", SaveType.OpenInAcrobat, Response);

I have a Server Error 500

My Page has componentart Controls …

Could you give me some help please.


Thanks for considering Aspose.

Please try the following codes again.

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
string surl = "http://mysite.com";
WebClient webClient = new WebClient();
byte[] myDataBuffer = webClient.DownloadData(surl);
MemoryStream postStream=new MemoryStream (myDataBuffer);
pdf.Save("Test.pdf", SaveType.OpenInAcrobat, Response);

Limitations on current version:

  • Cascading Styles Sheet (CSS) is not supported
  • Complicated Tags are not supported.

Detail information please go to https://docs.aspose.com/html/net/converting-between-formats/html-to-pdf/

I've already tried but it's the same...

The remote server returned an error: (500) Internal Server Error.

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.Net.WebException: The remote server returned an error: (500) Internal Server Error.

Source Error:

Line 26:             Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
Line 27:             WebClient webClient = new WebClient();
Line 28:             byte[] myDataBuffer = webClient.DownloadData(surl);
Line 29:             MemoryStream  postStream=new MemoryStream (myDataBuffer);
Line 30:             pdf.BindHTML(postStream);

For information, it works very fine with ABCpdf …

Our developers will check this issue and reply to you soon.

For informations :

It works with a page HTMLPage.htm but if i only change the extension to .aspx => Error 500.

These pages work fine when i directly access to them.


Can you attach a sample file of .aspx for me to check the exception?


We would check it.

It's a simple architecture :

  • Site Root (with authentication)
    • Page.htm (show only a Hello World message)
    • Page.aspx (show only a Hello World message)
    • ExportPDF.aspx (execute only the BindHTMLFromUrl())

It works for Page.htm but throw Error 500 on Page.aspx

Any ideas ?


Thanks for considering Aspose.

Our developers are now working hard on this problem but don't get it fixed up yet.

We will give a reply here as long as we get it done.

As your website has been visited by authentication, you should set the Credentials properties of the webClient class. It includes username and password.

You could get the help info from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetwebclientmemberstopic.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetnetworkcredentialclasstopic.asp.

Thank you and Good Luck!

I am struggling with this same issue and getting nowhere. I have this code (VB). My code dies on the pdf.BindHTML line with a 500 error. We are doing .net 2.0 authentication using the .net login control. Anyone out there please help!

Dim MyURL As Uri
MyURL = Request.Url

Dim client As New System.Net.WebClient()
client.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim myDataBuffer() As Byte = client.DownloadData(MyURL.AbsoluteUri)
Dim postStream As New MemoryStream(myDataBuffer)

pdf.Save(ConfigurationManager.AppSettings(“DataFolderPath”) & “COIPDFTest.pdf”)

Catch ex As Exception
ret = ex.Message

End Try


Please have a look at the Pdf.Credentials field. For more information please consult http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/aspose.pdf.pdf.credentials.html. You can use this with the BindHTMLFromUrl method.