Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Access cookies from Application module #1607


User avatar
0
eu11111 created

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)
  • User Avatar
    0
    hikalkan created
    Support Team

    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.