In ASP.NET, when you set a cookie, the path can be a virtual or a physical path. If you want to set the virtual path in a cookie, you can do so in your ASP.NET code without explicitly configuring anything in IIS. Please make sure the expiration time for the cookies.
HttpCookie myCookie = new HttpCookie("MyCookie");
myCookie.Value = "CookieValue";
myCookie.Path = "/virtualpath";
Response.Cookies.Add(myCookie);
You can also refer to the below solution:
https://stackoverflow.com/questions/54362266/configure-the-cookie-path-with-a-virtual-directory-in-addsession[
^]