NopCommerce 4.X no HttpCookie controller

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi,

I created a custom method to create a cookie so I can use it to track if a customer came to my site from a Google Ad, even if they don't buy the first time but return and place an order a few days after.  This is done so we can attribute the sale to a specific Google Ad campaign.

This works perfectly in our 3.6 Production site.  I'm working on upgrading to 4.X and cannot find the HttpCookie in the namespace.
In my 3.6 site, I added using System.Web at the top of the controller and got access to the HttpCookie but doing the same on 4.0 gives an error.

Any help will be much appreciated.
4 years ago
For that you should inherit IHttpContextaccestor. And use those methods.

Or you can get cookies code from webworkcontext.cs file.

Or follow this pretty document.

https://www.c-sharpcorner.com/article/asp-net-core-working-with-cookie/
4 years ago
I used the IHttpContextaccestor and it worked great.

Thanks  to SK5202!
4 years ago
Enjoy 😄😄
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.