I did an HttpOnly cookie using the article:
https://learn.microsoft.com/pt-br/dotnet/api/system.web.httpcookie.httponly?view=netframework-4.7.2
the creation of HttpOnly cookie is the following:
// Create an HttpOnly cookie.
HttpCookie myHttpOnlyCookie = new HttpCookie("LastVisit", DateTime.Now.ToString());
// Setting the HttpOnly value to true, makes
// this cookie accessible only to ASP.NET.
myHttpOnlyCookie.HttpOnly = true;
myHttpOnlyCookie.Secure = true;
myHttpOnlyCookie.Name = "MyHttpOnlyCookie";
Response.AppendCookie(myHttpOnlyCookie);
// Show the name of the HttpOnly cookie.
Response.Write(myHttpOnlyCookie.Name);
Ok, I saw this article that says: https://latesthackingnews.com/2017/07/03/what-is-httponly-cookie/
HttpOnly tells the browser to save the cookie without displaying it to client-side scripts. A secure flag, on the other hand, forces the browser to send cookies through an encrypted channel such as HTTPS, which stops eavesdropping, especially when an HTTPS connection is downgraded to HTTP through tools such as SSLStrip and so on.
Ok,
but I did an http-only cookie in my .aspx webpage but I could see it through Chrome's cookies file:
C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Default\Cookie
I set the flags:
myHttpOnlyCookie.HttpOnly = true;
myHttpOnlyCookie.Secure = true;
Question 1- if HttpOnly tells the browser to save the cookie without displaying it to client-side scripts, why could I access the name of the cookie within Chrome's cookie file?
Question 1.1- Is its content accessible, but just not using scripts?
Question 2- It's silly, but I can't access the HttpOnly cookie via aspx using the code:
HttpContext.Current.Request.Cookies["test_MyHttpOnlyCookietest"]
Is it the only way to access it via server side?
Question 3- When I put myHttpOnlyCookie.Secure = true;
I can't acess it via a non HTTPS connection - is that right? Just using https I can access it?
Question 4- If I use myHttpOnlyCookie.Secure = true
, there is an encryption and decryption.
How costly is this in processing power?