Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdfSession GetCookies return null Options
Mogens
Posted: Tuesday, March 28, 2017 10:25:09 PM
Rank: Newbie
Groups: Member

Joined: 10/21/2016
Posts: 3
Hi,

We have just updated to your latest version of the EO.PDF library, we upgraded from 5.0.64.2 to 2017.13.1. The previous version where removed from the project, and the new version installed via a NuGet package “EO.Pdf.17.1.3.0.nupkg”, during my regression testing I have found that HtmlToPdfSession has an issue loading the site into the session to obtain the cookie, hence when I load the HTML from the site to be converted to PDF, the resulting HTML is for the error that user is not authenticated.


Test Environment:
Windows 10 1607 Build 14393.953
IIS 10.0


C# Code sample:

Dictionary<string, string> dict = new Dictionary<string, string>()
{
{"username", oXmlApp.SelectSingleNode("//Dispatch_Email/_admin/username").WithDefault(string.Empty)},
{"password", oXmlApp.SelectSingleNode("//Dispatch_Email/_admin/password").WithDefault(string.Empty)},
{"estar", "Login"},
{"isams", "permission"}
};


// Set up credentials to bypass Admin login
System.Net.CookieCollection myCookies = new System.Net.CookieCollection();
using (HtmlToPdfSession session = HtmlToPdfSession.Create()) {
//Load the log in page
session.LoadUrl(secureURL + "_admin/");

foreach (KeyValuePair<string, string> kvp in dict) {
session.Fill(kvp.Key, kvp.Value);
}

session.Submit("submit");

myCookies = session.GetCookies(); //<-- return null and no exception
}
EO.Pdf.HtmlToPdf.Options.Cookies = myCookies;

Login form:

<form action="default.aspx?isams=permission" method="post" id="frm_main" autocomplete="off">
<input type="hidden" name="estar" value="Login">
<span>username</span>
<br>
<input tabindex="1" type="text" id="txt_user" name="username" maxlength="50">
<br>
<span>password</span>
<br>
<input tabindex="2" type="password" name="password" maxlength="50">
<div class="loginbuttons">
<input tabindex="3" alt="submit login" name="submit" title="submit login" type="image" src="images/btn_login.png">
</div>
</form>
eo_support
Posted: Thursday, March 30, 2017 1:17:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
Hi,

We have confirmed this to be an issue. This will be fixed in our next build. We will reply again as soon as the new build is posted.

Thanks!
eo_support
Posted: Tuesday, April 4, 2017 12:09:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
Hi,

This is just to let you know that we have posted a new build that should resolve this issue. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.