C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

โœ… Advanced style for subtitles

how does capcut make their subtitles with advanced style and if i wanna make it in C# which library should i use. Because i already tried one using ass file but I think ass file are not enough to make advanced style like glow or glitch effect

โœ… Integration testing, database transaction

hi i'm learning about dotnet test tools, using xunit i have a web app, i want to write some integration tests for it...

โœ… Selection using spectre.console

``cs using Spectre.Console; using System.Threading.Channels; void choiceMenu() {...
No description

โœ… connect a subscription model

Hi, I'm looking for someone to connect a subscription model, e.g., via Paddle, to my FocusMore appโ€”an app that boosts productivity and helps with everyday distractions. The app was created in WPF....
No description

โœ… Prevent unauthorized access to WEB API folders and files within the folder.

In my .NET 6 Web API project, I have an UploadFiles folder where user-uploaded files are stored. Currently, anyone who knows the folder path or file URL can directly access the files in the browser, since static file middleware serves them without authentication or authorization. I want to restrict access so that only authenticated users (or users with a signed/secure link) can download these files. Middleware like UseAuthentication and UseAuthorization doesnโ€™t protect static file requests by default....

โœ… C# private endpoint security: How should it be done?

Hi, I am working on a backend API which I want to be tightly coupled with Discord (some entity keys will be Discord snowflakes, like users and servers). My private endpoints will look like this: /users/:userId/servers/:serverId...

โœ… 4 compiler errors..I need someone to help me fix this

for anyone that is willing to help, here is the code: using system.Collections; using system.Collections.Generic; using UnityEngine; ...
No description

โœ… Integrating Postgre from EF

I am building a MVC app from ASP.NET I cant seem to create the database due to npgsql.design package being depreciated what could I do for this.

โœ… How should I organize user roles (User, Manager, Admin) in a single User entity with ASP.NET Core?

Hello I want to create a website where a user can search for coffee stores. Now, I've created a controller where a User can register, but this gives him automatically "user role". Now, I want also to create manager and admin roles, but I don't think for example admin needs so many attributes when registers, right?...

โœ… I need help with explanation of given entity attributes

Updated the post I've got recommended to add 3 attributes to my Entity: ```cs [Timestamp]...
No description

โœ… Hi this is my code and what ive done so far

my code: https://paste.mod.gg/jqrupyuavvys/0 this is what ive done and some of it cant get to work im not new to programming im just no so good with it. Thanks!...
No description

โœ… I'm a noob help

Can someone write me a plugin for Rust. as in the picture, I really liked the design and interface of this menu. But I can't do anything, and after a couple of attempts I gave up. Please help me out!
No description

โœ… Liskov's Substitution Principle - The L in SOLID

I believe to understand the principle quite well but I can't think of a way to adhere to it even in a basic example. "if it quacks like a duck but it needs batteries you got the wrong abstraction". Say there is RealDuck and RubberDuck. Both can quack, but the rubberduck needs batteries to quack. How can this be written without running into unexpected beahviour and with adhering to the principle? ...

โœ… Do you check in .snk files ?

So I'm about to publish my dll to Nuget and I'm researching recommended practices to do that. From what I found, first I'll generate a key pair using sn.exe tool, then use this to sign my dll to produce a strong named assembly. However, I thought since the .snk file contain both private and public key, I should not check it into the source control. But I saw some opensource project actually check this file in (example: nhibernate-core on github) So what's the correct practice here ? Do I check the .snk file in ? If I don't, where should I keep it securely ?...

I need someone to help fix my code

Hi, I'm making a school project using unity which translates real movement from a glove with sensors using an arduino into real movement in a hand in unity. The exhibition is in a few weeks and I have no clue what I'm doing. The only language I know is Python and I've been using chatgpt for this, but it's been able to complete very little. Please help....

Request Entity Too Large in Azure Web App Production Environment

I'm encountering an error when I'm using an OnPost handler in a razor page to upload files. In debug: the files upload no problem, but as soon as I push to production and try on the actual site: it gives me this error. I have put the following on my PageModel: ```...

โœ… Generic Binding Func<...> when you have inner generics is giving me "cannot infer types"

Been banging my head against this one for awhile now, I just cant seem to get the type inference to work right. So as an example I have this code that demonstrates the issue: ```...

โœ… Cache vs Persistence Repository and DI

anyone have recommendations, for a asp.net backend, a decent way to cache db results and make available to services? I was trying to register the cache as a singleton and the persistence repository as scoped, but I haven't fingered out an elegant way to do it. I figure this problem must have been solved a long time ago. I was thinking, services should NOT care if its CacheRepository or SqlServerRepository or PostgresRepository as long as it is IRepository, but I couldn't figure out how to make Cache IRepository as a singleton periodically refreshing from Postgres IRepository as a scoped...

Service Provider Question

I have a Blazor WASM intranet site with a backend API. I would like to have a really easy way of switching between dev/test/production api, where both the URI and the Name can be utilized in blazor. I created an APIConnection class, which has three classes that implement for each of dev/test/production (1st screenshot). Then I have added that class to service provider (2nd sceenshot). I can easily change the name of the class when I need to switch....
No description

Blazor Auto render mode authentication using external ASP.NET web api with ASP.NET Authentication

I'm a new guy into Blazor Authentication. I have tried to create an auto render mode blazor application, and because this is using external web api project (ASP.NET web api project) so the default individual template would not suit the requirement. Then I have tried to learn from official documents, stackover flow and some ai tools, so I got my template application on my git repo "https://github.com/TokisakiSusumu/AutoRenderDemoApiFromClient" so basically it is using its own Auth provider and Auth services for both SSR and CSR and both of them will point to the controllers in the server project and then it sends all the authentication api call to the backend web api which contains the dbcontext of the actual ASP.NET Identity tables. Currently it is kind of working but not in the normal way and I can't figure it out anymore and want some help. Currently the Login page in the Client project can only use @rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false)), if it uses @rendermode InteractiveWebAssembly then it would give the error as the screenshot shows. And if it is @rendermode InteractiveAuto, then the SSR basically won't work, what will happen is first time (SSR) it tries to login, api seems went through but I don't have the authentication state, so it will redirect me to the login page again (this time it is CSR), then it will work. and I have no idea why this happen. As well as the log out method, currently it is a form in the server project and the controller will then send a return LocalRedirect("~/"); back to be able to make the whole work flow of log out work, but I'm not sure if this is the correct way of doing it....
No description