Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vNext redirect to login return 404

I am using vNext and it runs well ok localhost but on the server the redirect to login feature does send me to the correct url (XXX/Account/Login?ReturnUrl=%2FMonitoring) but I get an error message.

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

The method:

[HttpGet]
        [AllowAnonymous]
        public IActionResult Login(string returnUrl)
        {            
            ViewBag.ReturnUrl = returnUrl;

            return View();
        }

Startup.cs

app.UseCookieAuthentication(options =>
            {
                options.AutomaticAuthenticate = true;
                options.AutomaticChallenge = true;
                options.AuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme;                
                options.CookieName = "WnctAuthCookie";
                if (!env.IsDevelopment())
                    options.CookieSecure = CookieSecureOption.Always;
                options.ExpireTimeSpan = TimeSpan.FromMinutes(60); 
                options.SlidingExpiration = true;
                options.LoginPath = new PathString("/Account/Login");
                options.LogoutPath = new PathString("/Account/Logout");
            });

I am using 1.0.0-rc1-final and I am also using IIS 7.5 under Windows 7 and I have https enabled.

I'm not sure weather this is due to a setting on IIS or something else. Does anyone have a solution?

like image 673
Mihai Bratulescu Avatar asked Feb 02 '26 09:02

Mihai Bratulescu


1 Answers

I am not sure but i think you have to enter file name with it's extension Like this

  options.LoginPath = new PathString("/Account/Login.aspx");
  options.LogoutPath = new PathString("/Account/Logout.aspx");
like image 51
Keval Bhatt Avatar answered Feb 04 '26 00:02

Keval Bhatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!