Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Reading images from localhost (or any intranet address)

$
0
0
Hi,

We are developing an application which will run on a secure intranet where users are authenticated using windows authentication. We are attempting to convert a HTML report to PDF. I can read images from external sites fine (such as bbc.co.uk) and these display in the PDF, however when I try to include an image from localhost when I run the application through IIS express no image displays. I tried using an image on our intranet and again no image displays. Below is very basic example we put together to try and isolate the problem.

C:\file.html

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src="http://thesource/images/logo" />
</body>
</html>

C# code:
Document doc = new Document(@"C:\file.html", options);
doc.Save(@"C:\file.pdf");
PDF is generated but no image is visible. Fiddler gives us the following response from our intranet server.
<h1>You are not authorized to view this page</h1>
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.<hr><p>Please try the following:</p><ul><li>Contact the Web site administrator if you believe you should be able to view this directory or page.</li><li>Click the <a href="javascript:location.reload()">Refresh</a> button to try again with different credentials.</li></ul><h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.<br>Internet Information Services (IIS)</h2>
When I replace the image with http://localhost:60700/Content/Images/calendar.png it appears no request is even made. Our images are stored in a database and accessible through an endpoint so we need to be able to request these images through a URL (either a relative or absolute path).

Please could someone look into the issues we are having an give us a response ASAP.

Many thanks

Viewing all articles
Browse latest Browse all 3131

Trending Articles