Access cookie from Mendix interface

0
Hi,   I am developing an application, where login happens and main contents are implement in DotNet framework.  How can I get the existing session information in Mendix page in this case ?   Thank you Iqbal
asked
1 answers
0

HI Iqbal,

If the cookie is a Secure or HTTP only cookie, you won't be able to read them.

 

Besides that, you can use JavaScript action to get the cookie. For e.g. to get cookie by name →

function getCookie(cname) {
  let name = cname + "=";
  let decodedCookie = decodeURIComponent(document.cookie);
  let ca = decodedCookie.split(';');
  for(let i = 0; i <ca.length; i++) {
    let c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}

 

answered