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

Free Support Forum - aspose.com

HTML to PDF .net web app session authentication

I’ve exploring aspose html to pdf in C# for converting my html reports in .net web application.
With trail pack , checking on our requirement .
Facing difficulties in authentication of session inside web app , while converting HTML to PDF via URL.
While session is still on , aspose converts the login page instead of actual url

How to pass session params in aspose to get the expected result?
PFB the c# code for references.

string url = "http://localhost:99375/home/Details?id=1008";
       HtmlLoadOptions options = new HtmlLoadOptions(url);

        options.PageInfo.IsLandscape = false;

        options.PageInfo.Height = 842;
        options.PageInfo.Width = 595;
        options.PageInfo.Margin = new MarginInfo(40, 110, 40, 110);// L,B,R,T
        options.PageInfo.AnyMargin = new MarginInfo(40, 110, 40, 110); // L,B,R,T
        options.HtmlMediaType = HtmlMediaType.Print;

        Document pdfDocument = new Document(GetContentFromUrlAsStream(url), options);


private static Stream GetContentFromUrlAsStream(string url)

        using (var httpClient = new HttpClient(handler))
            return httpClient.GetStreamAsync(url).GetAwaiter().GetResult();


Could you please attach your input HTML here for testing? We will investigate the issue and provide you more information on it.

I 've used raw webpage html to PDF.
For testing,
Use any URL on web application with authentication.

Instead of webpage content in PDF, i get output of that web app’s login screen


Please make sure that you have access to the web page that you are importing into Aspose.HTML DOM. Please save the web page to disk and check the HTML output in browser.