Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    env var from compose file is a possibility of you name that properly like ASPNETCORE__WHATEVER (i don't recall if it's one or two underscore)
    issue with that is that you have to put the env var into the compose file
    i wish there was a way to see -e from cli
    docker compose up -e <service>:<env>:<value> but i don't think that's a thing
    Marcus Turewicz
    Hi all, I've got a Razor Pages app where I'm trying to create the following page: /venues/{venue-name}/gigs , where {venue-name} is dynamic. The best I've come up with is to create a Venues Razor Page with a page directive like @page "{venue-name?}/{gigs?}", then check in the code behind that gigs == "gigs", but this feel pretty wrong. Any ideas/suggestions?
    Marcus Turewicz
    Think I got it, TIL:
        .AddRazorPagesOptions(options =>
            options.Conventions.AddPageRoute("/Venues/Gigs", "venues/{venuePath?}/gigs");
    Alok Sharma
    @marcusturewicz you know you can always use attribute routing, which gives much more control over routing options
    Alok Sharma
    anybody know how to get Html pages with final output (javascript executed) with net 5/6, it seems webbrowser class is now legacy any chromium based alternative?
    2 replies
    CodingTank Limited
    Alok Sharma


    will try this too

    does anybody ever implemented filewatchers in asp.net core, all examples that i see are either dotnet tools or windows/service/console apps
    Alberto Passalacqua
    filewatcher for? do you want to show the output in a web page?
    Alok Sharma
    i want to keep my css/js etc files precompressed
    Nicholas Budd
    so I'll preface this by saying I'm probably doing something unusual
    when using Minimal APIs to map endpoints, is there a way to have it map the params to an object?
    so, when you do .MapGet("some/url/structure", (string foo, int bar) => HandleRequest(foo, bar));
    instead of having to explicitly delcare all the params foo and bar there, can you just give it MyRequestObject that has properties Foo and Bar and have it do model binding?
    Michał Zegan
    i think minimal api does not have advanced full featured model binding. it's minimal for a reason
    Nicholas Budd
    maybe I could do this using the full Map methods instead
    basically, I've been working with this framework I've developed for use in APIs that uses a Result<T> type to let you signal error results without exceptions, for cases where errors are expected and not exceptional
    so you can do stuff like return Results.NotFound<User>(query.UserId); rather than having to throw new UserNotFoundException(query.UserId);
    Michał Zegan
    minimal api is minimal for a reason... and other map methods are doing direct route mapping to a low level request delegate
    Nicholas Budd
    so, we noticed that now that I've implemented automated mapping of Result<T> types to relevant HTTP results, all our controller methods are identical
    literally just
    var result = await _mediator.Send(query);
    return MapToResponse(result);
    in every controller method
    Nicholas Budd
    so I was wondering if there's a way to hook up something that registers that for stuff, but using different types of query
    I have it working mostly, but it's complaining that the body type is inferred and that's not allowed

    Custom Binding

    that looks promising but might require consuming applications to write binders for everything

    which... isn't the worst thing, but I was hoping to avoid it
    that said... in theory I could pull the URL, body, and query params into a collection, right?
    in fact that's probably already available
    just a flat dictionary of values
    and then use something like AgileMapper to map those onto the query object
    do that in a base type
    ...this is all probably a horrible abuse of Minimal APIs
    but if I can get it working then you can define a whole API like this
    and then just write a load of handlers
    (it uses MediatR under the hood)
    Lari Tuomisto
    any idea if I can somehow easily verify if model binding has occurred or not - I wish to verify that my uploaded files are actually being streamed without being loaded into memory

    hi guys :)

    If I have a URL as a string. Is there a way I can utilize the .Net's Query logic to automatically break up the parameters?


    That's a string not a context, is there a simple way to convert it to something so I can just go Query["id"] or something similar?

    Thank you in advance :)

    nevermind, typing it out I remember about HttpUtlity ... duh, thanks for being my rubber duck guys


    Hello, I have an asp.net core web application hosted on an azure app service. Is it possible to remote debug this application from visual studio ? I have tried to remote debug an asp.net core web application hosted on an IIS web server. It works fine. But azure app service does not work with IIS. It seems to run dotnet run command. So i don't know how can i remote debug this app. Thanks
    Alok Sharma
    Hello all, i need a little help with thread safe file writing to disk, i tried ReaderWriterLockSlim but it is not what i want (one write and many read) but still gets called on next requet
    basically i am creating disk files in middleware, so multiple users can concurrently hit the middleware and the scenario of using ReaderWriterLockSlim fails with recursion exception