Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cookie.HTTPOnly in classic ASP

Tags:

asp-classic

How to set all the cookie variables in a page to HTTPOnly in ASP?

like image 444
Morais Avatar asked Jun 29 '09 05:06

Morais


People also ask

How do I use HttpOnly attribute to cookies?

Set HttpOnly cookie in PHPini_set("session. cookie_httponly", True); This is the most common way to set cookies in PHP, empty variables will hold their default value.

What is HttpOnly in cookie?

An HttpOnly Cookie is a tag added to a browser cookie that prevents client-side scripts from accessing data. It provides a gate that prevents the specialized cookie from being accessed by anything other than the server.

Can I set HttpOnly cookie from browser?

If your browser supports HttpOnly, and you enable it for a cookie, a client-side script should NOT be able to read OR write to that cookie, but the browser can still send its value to the server. However, some browsers only prevent client side read access, but do not prevent write access.


1 Answers

I'm afraid using the Response.Cookies collection will not work when setting HttpOnly (it's been driving me slowly mad!). As vbscript (well at least on the server i'm testing on) will character encode the semicolon.

Instead, add the header manually yourself, for example:

Response.AddHeader "Set-Cookie", "YourCookieName=YourCookieValue; path=/; HttpOnly" 

There is a similar post on stackoverflow called: How exactly do you configure httpOnly Cookies in ASP Classic?

like image 155
Alex KeySmith Avatar answered Sep 29 '22 12:09

Alex KeySmith