setcookie

Angular 5, httpclient ignores set cookie in post

佐手、 提交于 2019-11-30 18:13:00
问题 I'm dealing with HttpClient in Angular 5, the problem is the cookie sent by the server during login process, it seems that Angular is ignoring it because next request with "withCredentials" is not setting it. My package.json .... "@angular/cli": "1.6.3", "@angular/compiler-cli": "^5.0.0", "@angular/language-service": "^5.0.0", .... my code makeLogin (us:string, password:string): Observable<any> { let body : any = new HttpParams() .set('username', us) .set('password', password); return this

jquery cookie set value to boolean true

╄→гoц情女王★ 提交于 2019-11-30 08:33:26
问题 I am using this jquery.cookie plugin and I need to set value to TRUE or NULL/FALSE. I am trying to do it like this: $.cookie('ff', true, { expires: 30, path: '/' }); but it sets the value to string and not boolean. Any ways of fixing this? 回答1: Cookies are only string-valued. As gdoron commented, if you want to treat the value as a boolean, you need to parse it back to a boolean when the cookie value is read back out. Since you commented that you are reading the cookie value with PHP, see

Android Volley, duplicate Set-Cookie is overridden

谁说我不能喝 提交于 2019-11-30 00:13:59
Trying to use Volley lib as a network wrapper for my android application. I have a connection up and running, but the problem is that every time there is multiple "Set-Cookie" headers in the response Volley uses Map that cannot have duplicate keys, and will only store the last Set-cookie header and overwrite the rest. Is there a workaround for this issue? Is there another lib to use? I tried overiding classes to fix this but when I had to edit NetworkResponse , I was descending too far down the rabbithole. So I decided to just edit Volley directly to grab all response headers in an array and

update cookie value in php

蓝咒 提交于 2019-11-29 16:23:07
I am converting the array into cookie by php serialize function $PromoteuserId='1'; $PromoteProductId='2'; $PromoteBrandId='3'; $PromoteProductArray = array("PromoteuserId"=>$PromoteuserId, "PromoteProductId"=>$PromoteProductId, "PromoteBrandId"=>$PromoteBrandId ); $Promotedcart[] = $PromoteProductArray; setcookie("Promotedcart", urlencode(serialize($Promotedcart)), time()+604800,'/'); And when the cookie is created then i am using the unserialize php function. print_r(unserialize(urldecode($_COOKIE['Promotedcart']))); I need to update the cookie value. E.g. - I need to search for

PHP session or cookie

天涯浪子 提交于 2019-11-29 03:49:14
What's best way to keep user logged on a PHP-powered site until he closes his browser? The first and the most popular way is to go with $_SESSION . The second is to pass zero as the third argument of setcookie function: setcookie(name, value, 0, domain); Alvin Wong As PHP session actually stores the SID by cookie (of course you can use other ways to set the SID if you like), there would not be much difference when simply using them. The main difference is security, because if you use cookies directly clients can see and/or edit them themselves, but for session the data is stored on the server

Create cookie with AngularJS

纵饮孤独 提交于 2019-11-29 00:28:47
I tried to use the code below to set cookies: angular.module('myApp').controller('myController', ['$scope', '$http','$cookies', function ($scope, $http, $cookies) { $scope.setMyCookie = function () { $cookies.put('Mykey', 'MyValue'); }; $scope.setMyCookie(); }]); I updated to version 1.3.14 of angular cookies, I know there is a breaking change, but how should I write the above code now ? Running the above code I get this error : Error: $cookies.put is not a function UPDATE : I have to do this in 2 files: var app = angular.module('myApp', ['ngRoute']); app.config(['$routeProvider', '

php setcookie domain

心已入冬 提交于 2019-11-28 21:17:05
Some application, not written by me, and not in PHP, creates a cookie for the domain "www.domain.com". I am trying to replace that cookie. So in php I did: setcookie('mycookie','mydata',time() + 2*7*24*60*60,'/','www.domain.com', false); However the resulting cookie is created for domain: ".www.domain.com", note the dot "." ahead of the domain. So it doesn't replace it, it creates another cookie. What can I do? The issue is also adressed here: http://php.net/manual/en/function.setcookie.php See comment by "jah": If you want to restrict the cookie to a single host, supply the domain parameter

How to parse HttpWebResponse.Headers.Keys for a Set-Cookie session id returned

耗尽温柔 提交于 2019-11-28 17:33:08
I'm trying to create an HttpWebRequest/HttpWebResponse session with an ASP.NET website to later parse an HTML form through url params (this part I know how to do), but I do not understand how to parse and set a cookie such as the session id. In Fiddler, it shows that the ASP.NET Session ID is returned through Set-Cookie in the response to the request to the / path of the url, but how can I extract this session id and set it as a cookie for the next HttpWebRequest? I understand that this Set-Cookie header would be found in HttpWebResponse.Headers.Keys, but is there a direct path to parsing it?

setting cross-subdomain cookie with javascript

佐手、 提交于 2019-11-28 10:43:16
How should I add domain support to these functions? I want to achieve that .example.com is declared as domain, so that the cookies can be read across all subdomains of the example.com. In its current form since domain is not set, it can only be read from www.example.com Tom Gullen Here is a link on how to share cookies amongst a domain: https://www.thoughtco.com/javascript-by-example-2037272 It involves setting the domain attribute of the cookie string like: document.cookie = "myValue=5;path=/;domain=example.com"; This cookie should now be accessible to all sub domains of example.com like

xmlhttprequest and set-cookie & cookie

一世执手 提交于 2019-11-27 20:41:37
i think i misunderstood the management of cookies with xmlhttprequest. I have a server that response to the XMLHttpRequest made in javascript, my server returns Allow-Control-Access-Origin , Access-Control-Allow-Headers , Access-Control-Expose-Headers and Access-Control-Allow-Credentials headers with the correct value. I'm doing a Digest Authenticate in a server with javascript, no problem in that, i receive ok the WWW-Authenticate header from server, i process and send to the server the Authorization header with all the digest-response and everything ok. The problem is, that when the digest