ServiceStack has default cookie names "ss-id" "ss-pid" and "ss-opt" defined in SessionFeature.cs
Is there a way to change the default names to something else?
The configuration code in HostConfig does not seem to reference it.
Would thank for the tips / pointers.
As you noted in SessionFeature.cs , cookie names are defined as constnot configured by the user.
const
, cookie - . configure:
const string mySessionIdentifier = "mySessionId"; // Converts incoming requests with "mySessionId" cookie to "ss-id" PreRequestFilters.Add((IRequest httpReq, IResponse httpRes) => { var cookie = httpReq.Cookies[mySessionIdentifier]; if (cookie != null) { httpReq.Cookies.Remove(mySessionIdentifier); httpReq.Cookies.Add(ServiceStack.Keywords.SessionId, cookie); } } // Converts responses with outgoing cookie "ss-id" to "mySessionId" GlobalResponseFilters.Add((IRequest httpReq, IResponse httpRes, object dto) => { var cookies = httpRes.CookiesAsDictionary(); string cookie; if (cookies.TryGetValue(ServiceStack.Keywords.SessionId, out cookie)) { httpRes.DeleteCookie(ServiceStack.Keywords.SessionId); httpRes.SetCookie(new Cookie(mySessionIdentifier, cookie)); } });
, .
cookie - , , MVC domain.com api api.domain.com. servicestack ( ), ss-id .. . IE Edge, cookie , Chrome .
- MVC .com , apis . - IE, Chrome, MVC .
, MVC servicestack. domain.com www.domain.com, servicestack MVC.
.
Source: https://habr.com/ru/post/1658454/More articles:Bot Framework застрял в диалоговом контуре - c#Pattern matching in tuple list - pattern-matchingSpark Data Sequences - scalaOverriding encapsulated CSS external component - cssКак создать и запустить код Rust с помощью одного ярлыка Sublime Text? - sublimetext3Does Cordoba prevent web pages from being dragged to field focus? - javascriptHow to use babel-node with nvm in VisualStudio code? - javascriptIs it possible to install node-sass without booting from Github at the post install stage? - nexusHTML5 поток OSX Safari ERROR - javascriptSavon ignores the namespace_identifier attribute - soapAll Articles