N
N
NNn1312021-06-30 17:56:00
ASP.NET
NNn131, 2021-06-30 17:56:00

Does it make sense to learn ASP.NET?

I write small web pages (purely a hobby), like a blog or some kind of chat, in general, they are not complicated. I always got by with the standard HttpListener from the C# library. Now I have learned about the existence of such a thing as Asp net core.
As I understand it, this is such a huge combine of everything, I slightly overdid it from the look of the "empty asp net project" in visual studio.
The question is this...
Write in Russian (not like on Wikipedia) what it is and why it is needed.
Does it make sense to study it for the sake of sites that are small in a couple of pages (but still server-side functionality, not just "give html by link")?
What killer features does it have that make life easier?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-06-30
@NNn131

Does it make sense to study it for the sake of sites that are small in a couple of pages (but still server-side functionality, not just "give html by link")?

For production, yes. HttpListener won't work even on Linux because it depends on http.sys
What killer features does it have that make life easier?

1. Fast
2. Flexible
Compared to httplistener.
I'm a bit overwhelmed by the "empty asp net project" view in visual studio.

Well, there it is really a little scary, in .NET 6 it will be made a little less scary.
In general, a minimal project looks something like this:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

Host.CreateDefaultBuilder(args)
    .ConfigureWebHost(webBuilder =>
    {
        webBuilder.UseKestrel(o =>
        {
            o.ListenLocalhost(5000);
        });
        webBuilder.ConfigureServices(services =>
        {
            services.AddRouting();
        });
        webBuilder.Configure(app =>
        {
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            });
        });
    })
    .Build()
    .Run();

In .NET 6 there will be a MinApi that looks like this (without usings):
var app = WebApplication.Create(args);

app.MapGet("/", string () => "Hello World!");

app.Run();

I
Ilya, 2021-06-30
@sarapinit

Does it make sense to study it for the sake of sites that are small in a couple of pages (but still server-side functionality, not just "give html by link")?

For such purposes, that part of asp.net called Razor Pages will suit you . Just get acquainted with the templating of pages.
But in general, using aspnet requires a deeper knowledge of the language. Will have to figure it out. So if you do not want to waste time, it is better to stay on simple pages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question