How do I create cookies in ASP.NET and read in PHP

Posted on 2009-04-17
Medium Priority
Last Modified: 2013-12-12
This might be a really silly question;

I want to create a cookie in an ASP.NET app, and then read the same cookie in a php script, before I waste an hour attempting to do it, is it possible, and  would it simply be a case of creating a cookie within the same domain?
Question by:eivo

Accepted Solution

cmaohio earned 1000 total points
ID: 24170437
Yes, cookies are program independent. they can be read by any application as long as it's the same domain.  So you can create one in ASP.NET and then read it in PHP.

however, some browsers won't allow third-party domains to be set. i.e. if you're on domain1.com and you want to set a cookie for domain2.com some browsers don't allow that, it is a user preference setting.

Now, if you're doing something like aspsite.domain1.com and reading it on phpsite.domain1.com then you simply have to set the cookie to .domain1.com (with the leading period) and it will read on both.

Author Closing Comment

ID: 31571553
Terrific, I had thought as much, just wanted to check.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question