Open Closed

Not able to Explicitly set application cookie path for my Application #1852


User avatar
0
Anjaneyulu created
  • ABP Framework version: v4.4.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:" 1. Create a ABP mvc project
  • 2.Set application cookie path to Application folder rather than default root path '/ by
context.Services.ConfigureApplicationCookie(options =>
{
    options.Cookie.Path = "/Arc";
    options.Cookie.SameSite = SameSiteMode.Strict;
    options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
    options.Cookie.IsEssential = true;
    options.Cookie.HttpOnly = true;
});
             

3.. Go to developer tools in the browser and check the path. It is still set to default.


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You are configure the ApplicationCookie not XSRF and Antiforgery.

    Can you explain the reason to change the path?

  • User Avatar
    0
    Anjaneyulu created

    hi

    You are configure the ApplicationCookie not XSRF and Antiforgery.

    Can you explain the reason to change the path?

    Hi,

    Basically when i hosted the application cookie path is coming as default root path i.e., path='/'.

    But i want to set the path to application folder in IIS when hosted.

    Can you please help to set that properly.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

  • User Avatar
    0
    Rajasekhar created

    After setting the cookie path. we are not able to login.

    I am getting error like this :

    2021-09-18 19:59:22.135 -07:00 [INF] Antiforgery token validation failed. The required antiforgery cookie ".AspNetCore.Antiforgery.BAuz9xcm0sM" is not present. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.BAuz9xcm0sM" is not present. at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext) at Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.ValidateAntiforgeryTokenAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context) 2021-09-18 19:59:22.254 -07:00 [INF] Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.AutoValidateAntiforgeryTokenAuthorizationFilter'. 2021-09-18 19:59:22.260 -07:00 [INF] Executing HttpStatusCodeResult, setting HTTP status code 400

  • User Avatar
    0
    Anjaneyulu created

    hi

    We could set the Application Cookie's path as per your reply, we are missing antiforgery token and not able to authenticate. Can you please help us.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I think we should not change the path, IIS will automatically handle it.

    We seem to be stuck in the X Y problem. https://xyproblem.info/

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09