ASP.NET Session Cookies – specifying the base domain

Create a ISessionIDManager, since you only want to change the cookie domain we will let the default one do all the work. This is configured in web.config on the sessionState element under <system.web>. <sessionState sessionIDManagerType=”MySessionIDManager” /> And the implementation. public class MySessionIDManager: SessionIDManager, ISessionIDManager { void ISessionIDManager.SaveSessionID( HttpContext context, string id, out bool redirected, out … Read more

Reopening a session in PHP

session_start(); … session_write_close(); … ini_set(‘session.use_only_cookies’, false); ini_set(‘session.use_cookies’, false); ini_set(‘session.use_trans_sid’, false); ini_set(‘session.cache_limiter’, null); session_start(); // second session_start This will prevent php from calling php_session_send_cookie() a second time. See it working. Though restructuring the scripts still seems to be the better option… For PHP 7.2+, you will basically need to re-implement session cookies to avoid errors and … Read more

How long do the new Places API session tokens last?

As far as I can see there is no official documentation regarding session duration for Places API in Google Maps Platform. I can share some information about sessions obtained from the technical support, however, it doesn’t provide exact value for session duration and it looks like Google won’t reveal the exact value. First of all, … Read more

Spring Framework 3 and session attributes

It throws Exception if controller called first time even though added @SessionAttributes({“form”}) to class. So add following populateForm method will fix this. @SessionAttributes({“form”}) @Controller public class MyController { @ModelAttribute(“form”) public Form populateForm() { return new Form(); // populates form for the first time if its null } @RequestMapping(value=”form”, method=RequestMethod.GET) public ModelAndView viewForm(@ModelAttribute(“form”) Form form) { … Read more

laravel – Can’t get session in controller constructor

You can’t do it by default with Laravel 5.3. But when you edit you Kernel.php and change protected $middleware = []; to the following it wil work. protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, ]; protected $middlewareGroups = [ ‘web’ => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ‘api’ => [ ‘throttle:60,1’, ‘bindings’, ], ]; Hope … Read more

Can OWIN middleware use the http session?

Yes, but it’s quite a hack. It also won’t work with SignalR because SignalR MUST run before session is acquired to prevent long session locks. Do this to enable session for any request: public static class AspNetSessionExtensions { public static IAppBuilder RequireAspNetSession(this IAppBuilder app) { app.Use((context, next) => { // Depending on the handler the … Read more

session_start() takes VERY LONG TIME

session_start (with sessions stored in files) is blocking in PHP, so this issue will appear if you try to start several server sessions for the same browser session (AJAX or multiple browser tabs/windows). Each session_start will wait until the other sessions have been closed. See here: http://konrness.com/php5/how-to-prevent-blocking-php-requests/ Try changing from files to database storage of … Read more