Hi,
I'm trying to allow ASPNet Core Application(using EF6) the ability to use Session to store User Information.
Following the instructions on this link:
https://www.exceptionnotfound.net/finding-and-using-asp-net-session-in-core-1-0/
Project.json - dependency section:
"dependencies": {
"AutoMapper": "5.2.0",
"EntityFramework": "6.1.3",
"EntityFramework.CodeFirstStoreFunctions": "1.0.0",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNet.Session": "1.0.0-rc1-final", /* new added */
"Microsoft.AspNet.Http": "1.0.0-rc1-final", /* new added */
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
Startup.cs
public void ConfigureServices(IServiceCollection services)
{ // Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddScoped<SVPData>(_ => new SVPData(Configuration.GetConnectionString("DefaultConnection")));
services.AddMvc();
services.AddMemoryCache();
services.AddSession(options =>
{ options.IdleTimeout = TimeSpan.FromMinutes(15);
options.CookieName = ".MyCoreApp"; });
}
The last line errors :
Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions.AddSession(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Microsoft.AspNetCore.Builder.SessionOptions>)' and 'Microsoft.Extensions.DependencyInjection.SessionServiceCollectionExtensions.AddSession(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Microsoft.AspNet.Session.SessionOptions>)'
If I try to change the version of the lines(as suggested in the link below):
Project.json
"Microsoft.AspNet.Session": "1.0.0", /* new added */
"Microsoft.AspNet.Http": "1.0.0", /* new added */
Output tab displays:
log : Restore failed in 6853ms.
Errors in C:\Deployed\SVPWebApp\src\SVPWebApp\SVPWebApp.xproj
Unable to resolve 'Microsoft.AspNet.Session (>= 1.0.0)' for '.NETFramework,Version=v4.5.2'.
Unable to resolve 'Microsoft.AspNet.Http (>= 1.0.0)' for '.NETFramework,Version=v4.5.2'.
I appreciate your input!
Thanks,
tinac99