如何设置“过期”日期的格式VBScript 中手动 Set-Cookie 标头中的值?

发布于 2024-09-01 07:18:09 字数 433 浏览 4 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

腹黑女流氓 2024-09-08 07:18:09

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文