I'm using 1.0.1
version of asp.net core
and I'm using authentication in my form.
I use UseCookieAuthentication
and its gives an error
Cannot convert lambda expression to type 'CookieAuthenticationOptions' because it is not a delegate type
In the Startup.cs
, configure method.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseApplicationInsightsRequestTelemetry();
app.UseExceptionHandler("/Home/Error");
app.UseApplicationInsightsExceptionTelemetry();
app.UseStaticFiles();
app.UseSession();
app.UseCookieAuthentication(options =>
{
options.AutomaticAuthenticate = true;
options.AutomaticChallenge = true;
options.LoginPath = "/Home/Login";
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=About}/{id?}"
);
});
}
You need to pass in the options, not a lambda: