Is there a way to mark classic ASP ASPSESSIONID* cookies as secure? It appears that the ASP ISAPI handler adds that session id cookie after my page is done rendering so putting code at the end of my page to loop through the Response.Cookie collection and mark them as secure doesn't seem to touch the ASPSESSIONID* cookie. Any other way of doing this?
相关问题
- Multiple Django sites on the same domain - CSRF fa
- Data loss during sending via $_SESSION from one sc
- Save html in cookie
- Chrome not keeping my _SESSION vars when coming fr
- Using a session with php and Java
相关文章
- Page指令 的EnableSessionState="ReadOnly",怎么在web.confi
- How exactly do Firebase Analytics handle session d
- fetch: Getting cookies from fetch response
- Symfony2: check whether session exists or not
- Can a VBScript function return a dictionary?
- How do I send cookies with request when testing Fl
- Is ![removed] reliable?
- When is destructor called in a WCF service
As found here, an UrlRewrite rule can handle this.
The rules below handle it for adding both
HttpOnly
andSecure
if they are missing on theASPSESSIONID
cookie. (For other cookies, normally they are emitted by the site ASP code: better handle that directly in the code responsible for them.)If UrlRewrite is not installed in the IIS Server, this will crash the site.
Note that the
Secure
rule should not be applied if the site is legitimately accessed overhttp
instead ofhttps
, thus the condition for not emitting it when browsing it locally. IfSecure
is emitted for a site accessed overhttp
from the client end, the client will not send the cookie back to the server.(I avoid testing the inbound protocol, because the sites I work on are not supposed to be accessed on
http
anyway, excepted eventually directly from their hosting server or load-balancer.)I have previously tried using asp/session/keepSessionIdSecure, but it has no effect (at least for a site behind a load-balancer terminating the https and accessing the site server over http). This setting is the modern version (IIS 7+) of the
AspKeepSessionIDSecure
Metabase value pointed by AnthonyWJones answer.The answer is no there isn'tThere isn't on the standard UI provided by IIS manager. However, you can enable secure cookies for the SessionID via the AspKeepSessionIDSecure Metabase valueI run this command:
CSCRIPT C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/1/AspKeepSessionIDSecure 1
More information here: http://blogs.msdn.com/b/rahulso/archive/2007/06/19/cookies-case-study-with-ssl-and-frames-classic-asp.aspx
[Edit: You can ignore the following. I just realized that you were talking about ASPSESSIONID.}
There is built-in support for secure cookies.
See http://msdn.microsoft.com/en-us/library/ms524757.aspx
Example (for ASP.Net, not Classic ASP):