mirror of https://github.com/abpframework/abp.git
committed by
GitHub
12 changed files with 79 additions and 98 deletions
@ -0,0 +1,32 @@ |
|||||
|
using System; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.MultiTenancy |
||||
|
{ |
||||
|
public static class AbpMultiTenancyCookieHelper |
||||
|
{ |
||||
|
public static void SetTenantCookie( |
||||
|
HttpContext context, |
||||
|
Guid? tenantId, |
||||
|
string tenantKey) |
||||
|
{ |
||||
|
if (tenantId != null) |
||||
|
{ |
||||
|
context.Response.Cookies.Append( |
||||
|
tenantKey, |
||||
|
tenantId.ToString(), |
||||
|
new CookieOptions |
||||
|
{ |
||||
|
Path = "/", |
||||
|
HttpOnly = false, |
||||
|
Expires = DateTimeOffset.Now.AddYears(10) |
||||
|
} |
||||
|
); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
context.Response.Cookies.Delete(tenantKey); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue