How do I access HttpContext in Server-side Blazor?

Add the following to Blazor.Web.App.Startup.cs: services.AddHttpContextAccessor(); You also need this in <component-name>.cshtml @using Microsoft.AspNetCore.Http @inject IHttpContextAccessor httpContextAccessor Note: At the time when this answer was written, accessing the HttpContext was done as described above. Since then, Blazor has been under rapid development, and has fundamentally changed. It is definitely deprecated the usage described above, but … Read more

Same-Site flag for session cookie in Spring Security

New Tomcat version support SameSite cookies via TomcatContextCustomizer. So you should only customize tomcat CookieProcessor, e.g. for Spring Boot: @Configuration public class MvcConfiguration implements WebMvcConfigurer { @Bean public TomcatContextCustomizer sameSiteCookiesConfig() { return context -> { final Rfc6265CookieProcessor cookieProcessor = new Rfc6265CookieProcessor(); cookieProcessor.setSameSiteCookies(SameSiteCookies.NONE.getValue()); context.setCookieProcessor(cookieProcessor); }; } } For SameSiteCookies.NONE be aware, that cookies are also Secure … Read more

how to disable cookies using webdriver for Chrome and FireFox JAVA

I’ve just get solution for Firefox: FirefoxProfile profile = new ProfilesIni().getProfile(“default”); profile.setPreference(“network.cookie.cookieBehavior”, 2); driver = new FirefoxDriver(profile); for Chrome (block all cookies) ChromeOptions options = new ChromeOptions(); options.AddUserProfilePreference(“profile.default_content_setting_values.cookies”, 2); for Chrome (block only third party cookies) ChromeOptions options = new ChromeOptions(); options.AddUserProfilePreference(“profile.default_content_setting_values.cookies”, 1); options.AddUserProfilePreference(“profile.cookie_controls_mode”, 1);

IE8 losing session cookies in popup windows

This is ‘new’ functionality in IE8! Checkj out the IE8 blog below to read about it. http://blogs.msdn.com/askie/archive/2009/03/09/opening-a-new-tab-may-launch-a-new-process-with-internet-explorer-8-0.aspx IE8 can use multiple processes for handling an x number of IE windows. When you cross a process space, you loose your cookies (Asp.Net session ID seems to be retained over this process boundry). I personally think it’s … Read more

Send cookies with curl

You can use -b to specify a cookie file to read the cookies from as well. In many situations using -c and -b to the same file is what you want: curl -b cookies.txt -c cookies.txt http://example.com Further Using only -c will make curl start with no cookies but still parse and understand cookies and … Read more

Can two different browser share one cookie?

You can build a cookie-proxy by creating a Flash application and use Shared Objects (SO = Flash cookies) to store data. Any Browsers with Flash installed could retrieve the informations stored in the SO. But, it’s an ugly workaround. Just don’t share cookies… and find another way to build your website/app.

How cookies work?

Understanding Cookies Cookies are given to a browser by the server. The browser reveals the cookies as applicable only to the domain that provided the cookie in the first place. The data in the cookie allows the server to continue a conversation, so to speak. Without the cookie, the server considers the browser a first-time … Read more