如何设置“过期”日期的格式VBScript 中手动 Set-Cookie 标头中的值?
我在 VBScript 中手动添加 Set-Cookie 标头,以便可以包含 HttpOnly
。
当我创建包含此 expires
值的 Set-Cookie
标头时:
expires=5/13/2010 9:57:35 AM;
Internet Explorer 8 不会设置 cookie(FireFox 会设置)。这就是 Response.Cookies("cookieName") 设置时 expires
日期格式的样子。Expires:
expires=Tue, 01-Jan-1980 08:00:00 GMT;
如何格式化第一个日期,使其看起来像第二个日期?
谢谢。
I'm adding a header for Set-Cookie manually, in VBScript, so that I can include HttpOnly
.
When I make a Set-Cookie
header that includes this expires
value:
expires=5/13/2010 9:57:35 AM;
Internet Explorer 8 does not set the cookie (FireFox does). This is what expires
date formatting look like when set by Response.Cookies("cookieName").Expires:
expires=Tue, 01-Jan-1980 08:00:00 GMT;
How can I format the first date so that it looks like the second date?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VBScript 的 FormatDateTime() 非常有限,因此这不是一个选项你的情况。据我所知,按照您的要求格式化日期的唯一选择是编写一个相当长且乏味的函数来解析日期,可能会自由使用 DatePart() 函数...就个人而言,我只是更改为 Asp.Net 而不是而不是费心,但这可能是不可行的。
但是,上一个问题,它提出了您没有问的问题,但是(我认为)你应该的,可能对你更有帮助。
VBScript's FormatDateTime() is pretty limited, so that's not an option in your case. As far as I can see, your only option to format the date as you are asking would be to write a rather long and tedious function to parse out the date, probably with liberal use of the DatePart() function... Personally, I'd just change to Asp.Net rather than bother with it, but likely that's not feasible.
However, this previous question, which asks the question you're not asking but (I think) you should be, may be more helpful to you.