Persistent Cookie isn't being found The Next CEO of Stack OverflowCookies and ObjectsHow do I set/unset a cookie with jQuery?Local Storage vs CookiesAndroid HttpClient persistent cookiessetting persistent cookies with javascriptRemember me Persistent Cookie in C#ASP.NET_SessionId + OWIN Cookies do not send to browserasp.net mvc 5 cookies not persisting on local serverPersistent Cookie is not working in cross browser'sread form authentication cookie between websites on same server
How do I reset passwords on multiple websites easily?
How to safely derail a train during transit?
Interfacing a button to MCU (and PC) with 50m long cable
Anatomically Correct Strange Women In Ponds Distributing Swords
Return the Closest Prime Number
How do I make a variable always equal to the result of some calculations?
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
Elegant way to replace substring in a regex with optional groups in Python?
What was the first Unix version to run on a microcomputer?
Is 'diverse range' a pleonastic phrase?
Several mode to write the symbol of a vector
To not tell, not take, and not want
If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?
What flight has the highest ratio of time difference to flight time?
Can you replace a racial trait cantrip when leveling up?
Why am I allowed to create multiple unique pointers from a single object?
Which tube will fit a -(700 x 25c) wheel?
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Is it ever safe to open a suspicious html file (e.g. email attachment)?
How do I transpose the 1st and -1th levels of an arbitrarily nested array?
Which kind of appliances can one connect to electric sockets located in a airplane's toilet?
What happened in Rome, when the western empire "fell"?
What's the best way to handle refactoring a big file?
Are there any unintended negative consequences to allowing PCs to gain multiple levels at once in a short milestone-XP game?
Persistent Cookie isn't being found
The Next CEO of Stack OverflowCookies and ObjectsHow do I set/unset a cookie with jQuery?Local Storage vs CookiesAndroid HttpClient persistent cookiessetting persistent cookies with javascriptRemember me Persistent Cookie in C#ASP.NET_SessionId + OWIN Cookies do not send to browserasp.net mvc 5 cookies not persisting on local serverPersistent Cookie is not working in cross browser'sread form authentication cookie between websites on same server
I am trying to pass information between two asp.net C# web applications using a persistent cookie. In the first application, I'm creating the cookie like this:
HttpCookie myCookie = new HttpCookie("myCookie");
myCookie.Values["foo"] = "some value";
// repeat for each value added
myCookie.Expires = DateTime.Now.AddHours(1);
Response.Cookies.Add(myCookie);
In my second application, I check for the cookie this way:
if (Request.Cookies["myCookie"] == null)
//gtfo
else
//come on in!
The problem is that when the user arrives at the second application, the cookie often isn't found on the fist try. They can't get to the second application but through the first, and they have to login at the first application, which sets the cookie.
I have tried adding a "if (Request.Cookies["myCookie"] == null)" to the first application to make sure the cookie is set, but this doesn't fix the problem. Checking for "Request.Cookies["myCookie"].Value" instead of "Request.Cookies["myCookie"]" throws an "object reference not set" error.
How can I make sure the cookie is found on the first try?
c# asp.net cookies
add a comment |
I am trying to pass information between two asp.net C# web applications using a persistent cookie. In the first application, I'm creating the cookie like this:
HttpCookie myCookie = new HttpCookie("myCookie");
myCookie.Values["foo"] = "some value";
// repeat for each value added
myCookie.Expires = DateTime.Now.AddHours(1);
Response.Cookies.Add(myCookie);
In my second application, I check for the cookie this way:
if (Request.Cookies["myCookie"] == null)
//gtfo
else
//come on in!
The problem is that when the user arrives at the second application, the cookie often isn't found on the fist try. They can't get to the second application but through the first, and they have to login at the first application, which sets the cookie.
I have tried adding a "if (Request.Cookies["myCookie"] == null)" to the first application to make sure the cookie is set, but this doesn't fix the problem. Checking for "Request.Cookies["myCookie"].Value" instead of "Request.Cookies["myCookie"]" throws an "object reference not set" error.
How can I make sure the cookie is found on the first try?
c# asp.net cookies
add a comment |
I am trying to pass information between two asp.net C# web applications using a persistent cookie. In the first application, I'm creating the cookie like this:
HttpCookie myCookie = new HttpCookie("myCookie");
myCookie.Values["foo"] = "some value";
// repeat for each value added
myCookie.Expires = DateTime.Now.AddHours(1);
Response.Cookies.Add(myCookie);
In my second application, I check for the cookie this way:
if (Request.Cookies["myCookie"] == null)
//gtfo
else
//come on in!
The problem is that when the user arrives at the second application, the cookie often isn't found on the fist try. They can't get to the second application but through the first, and they have to login at the first application, which sets the cookie.
I have tried adding a "if (Request.Cookies["myCookie"] == null)" to the first application to make sure the cookie is set, but this doesn't fix the problem. Checking for "Request.Cookies["myCookie"].Value" instead of "Request.Cookies["myCookie"]" throws an "object reference not set" error.
How can I make sure the cookie is found on the first try?
c# asp.net cookies
I am trying to pass information between two asp.net C# web applications using a persistent cookie. In the first application, I'm creating the cookie like this:
HttpCookie myCookie = new HttpCookie("myCookie");
myCookie.Values["foo"] = "some value";
// repeat for each value added
myCookie.Expires = DateTime.Now.AddHours(1);
Response.Cookies.Add(myCookie);
In my second application, I check for the cookie this way:
if (Request.Cookies["myCookie"] == null)
//gtfo
else
//come on in!
The problem is that when the user arrives at the second application, the cookie often isn't found on the fist try. They can't get to the second application but through the first, and they have to login at the first application, which sets the cookie.
I have tried adding a "if (Request.Cookies["myCookie"] == null)" to the first application to make sure the cookie is set, but this doesn't fix the problem. Checking for "Request.Cookies["myCookie"].Value" instead of "Request.Cookies["myCookie"]" throws an "object reference not set" error.
How can I make sure the cookie is found on the first try?
c# asp.net cookies
c# asp.net cookies
asked Mar 7 at 15:18
Robert MurrellRobert Murrell
106111
106111
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047198%2fpersistent-cookie-isnt-being-found%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047198%2fpersistent-cookie-isnt-being-found%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown