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: 134
  • Last Modified:

How do I both send a Cookie and redirect the browser

How do I both send a Cookie and redirect the browser

       Send "Content-type: text/html"
       Send "Set-Cookie: Skattejagt=user; path=/;"
       Send "Location: " & SetTreasure
       Send ""
0
jfl
Asked:
jfl
  • 2
1 Solution
 
bverCommented:
You should not send both content-type and location entity-headers back to a client because these headers are exclusive.

The response should be rather:

       Send "Location: " & SetTreasure
       Send "Set-Cookie: Skattejagt=user; path=/;"
       Send "" 

assuming SetTreasure variable contains a valid URI for the redirection target.


0
 
jflAuthor Commented:
The browser is not setting a cookie if I redirect
0
 
aioudineCommented:
require("cgilib.pl");
$SetTreasure = "HTTP://WWW.NOVELL.COM";
print "Set-Cookie: user=aioudine; path=/;";
print &PrintHeader;
print "<META http-equiv=\"refresh\" content=\"0;url=".$SetTreasure."\">";
---- end----
0
 
jflAuthor Commented:
I have thought about that too, but it's not preferable
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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