Tag:Core2.0

  • Codefirst builds ASP. Net core2.0 website from scratch

    Time:2021-6-28

    Step by step, I will teach you how to build ASP. Net core2.0 website. All of the following are built in. Net core2.0 environment and have been built Right click Solutions > New Project > Select web > ASP. Net core web application (. Net core) Select web application, do not select to enable docker […]

  • Talking about ASP.NET Core 2.0 Middleware

    Time:2020-11-26

    problem How to create the simplest ASP.NET Core middleware? answer Use VS to create a ASP.NET Empty project of core 2.0, please note Startup.cs Configure() method in: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.Run(async (context) => { await context.Response.WriteAsync(“Hello World! (Run)”); }); } A better way to create a request pipeline is to use […]

  • [translation] ASP.NET How to redirect the core 2.0 web address

    Time:2020-11-20

    problem How to ASP.NET URL redirection in core 2.0? answer Create an empty project in Startup.cs In the rewriter options, add the middleware URL: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var rewrite = new RewriteOptions() .AddRedirect(“films”, “movies”) .AddRewrite(“actors”, “stars”, true); app.UseRewriter(rewrite); app.Run(async (context) => { var path = context.Request.Path; var query = context.Request.QueryString; await […]

  • Talking about ASP.NET Partial view of core 2.0

    Time:2020-11-11

    problem How to ASP.NET Using partial views in core 2.0 to reuse common parts of a page? answer Create an empty project and add MVC service and Middleware in startup public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(routes => { routes.MapRoute( name: “default”, […]