Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

Using windows forms, is it possible to write cookies?

Is it it possible to use windows forms in vb.net to write to a cookie file, which can then be read by a php application?

What Id like is to run a executable which writes a cookie with a value (eg SessionID=randomString) to a particular domain (eg http://mydomain.com) then on my webserver have a php file which is able to read the cookie and display it.

I already know how to read cookies with PHP, so I dont need help with that. I just need to figure out how to write a cookie value which that can be read by a browser.

Thanks in advance.
0
tonelm54
Asked:
tonelm54
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
Cookies are written to a browser in the http response header from a web site.  And you seem to know that cookies can only be read on the domain that set them.  If your program is running as a web page on that domain, any cookies you set can be read by any other language on that domain.  You can set a cookie with ASP.NET and read it with PHP.

This simple little PHP page will show all the cookies that are set for the domain that it comes from:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Cookie Dump</title>
</head>
<body>
<h1>Cookie Dump</h1>
<?php 
var_dump($_COOKIE);
echo "<br>&nbsp;<br>";
print_r($_COOKIE);
?>
</body>
</html>

Open in new window

0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now