Is there a way to access cookies in the Application module? I am trying to create an Attribute capable of verifying a flag in an attribute and can't seem to access Request.Cookies from it.
Thanks in advance
1 Answer(s)
-
0
You can not and you don't have to, since app layer is independent from web layer and cookie does not have a meaning here. So, solution? Create an abstraction (define an interface) and implement it in web layer (where you can get cookies) and register it to dependency injection (simplest way is using ITransientDependency - <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection#DocHelperInterfaces">http://www.aspnetboilerplate.com/Pages/ ... Interfaces</a>). Then you can inject this interface in app layer to get the value.