【发布时间】:2017-05-31 16:08:06
【问题描述】:
我正在使用asp.net core 的1.0.1 版本,并且在我的表单中使用身份验证。
我使用UseCookieAuthentication,它给出了一个错误
无法将 lambda 表达式转换为类型“CookieAuthenticationOptions”,因为 它不是委托类型
在Startup.cs,配置方法。
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?}"
);
});
}
【问题讨论】:
-
请详细说明您要做什么以及问题所在
标签: c# asp.net-mvc asp.net-core forms-authentication