Beispiel #1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddAuthentication(options =>
     {
         options.DefaultSignInScheme       = CookieAuthenticationDefaults.AuthenticationScheme;
         options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
         options.DefaultChallengeScheme    = CookieAuthenticationDefaults.AuthenticationScheme;
     }).AddCookie(options => { options.LoginPath = "/Login"; });
     services.AddMvc().AddRazorPagesOptions(options =>
     {
         options.Conventions.AuthorizeFolder("/");
         options.Conventions.AllowAnonymousToPage("/Login");
     });
     TcpComunicare tcpComunicare = new TcpComunicare();
     //  services.AddSingleton<ITcpService>(TcpServer.TcpService);
 }
Beispiel #2
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
 {
     app.UseAuthentication();
     app.UseMvc();
     TcpComunicare tcpComunicare = new TcpComunicare();
 }