gwan重定向后创建cookie [英] gwan redirection after create cookie
本文介绍了gwan重定向后创建cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于我的表单验证网页,我想创建一个Cookie,并重定向到另一个网页,但不起作用。重定向阻止创建cookie。你有什么解决方案吗?
For my form validation page, I'd like to create a cookie and be redirected to another page but that doesn't work. Redirection prevents the creation of cookie. Do you have any solution ?
推荐答案
一种方法是从G-WAN处理程序创建cookie,绕过servlet或自动生成的重定向,但您也可以使用此方法:
A way to proceed is to create the cookie from a G-WAN handler, bypassing the servlet or the automatically generated redirection, but you can also use this method:
#include "gwan.h" // G-WAN exported functions
int main(int argc, char *argv[])
{
char redir[] = "Cookie: blah\r\n" // add a cookie in the response
"Location: 100.html\r\n\r\n";
http_header(HEAD_ADD, redir, sizeof(redir) - 1, argv);
return 301; // return an HTTP code (301:'Moved')
}
这篇关于gwan重定向后创建cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文