C#

C

C#

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

Join

I can't find an ASP.NET Core Template

Hello everyone, I decided to take a break from Unity and tried to learn ASP.NET I found a video on YouTube and followed it. But I had a little trouble on the way, I can't find the same template as shown in the image here. I wonder if the name of the template was changed or something ? Thank you for your help...
No description

How to Filter Firebase Real-Time Data for the Logged-In User in a Maui Application?

In my Maui application, I have successfully implemented email/password authentication and real-time data synchronization. To filter data so that only the logged-in user's relevant documents are shown, should I add a new property (e.g., ownerId) to each document and perform the filtering on the client side? I saw WhereEqualTo could filter but is this the right approcach to filter on the client by the ownerid? But it means I need to store the userId on the client, is it safe? ...

Azure Static Web App (Blazor) problem with CORS

Hello, I have been developing a blazor wasm app that uses multi threading. The problem is that I don't know how can i set these headers Cross-Origin-Embedder-Policy:require-corp & Cross-Origin-Opener-Policy:same-origin. I tried to set them like the docs suggested in staticwebapp.config.json like: ```{ "globalHeaders": {...

Multi-Select dropdown in wpf?

I am learning C# and wpf at the moment, for school we have a project and need to build a program in C# and a ui using wpf for a Vacation Park. The user needs to select a park by choosing a location and facilities. For the Location I thought a Combobox is a good choice since there is only one choice but for facilities they can select multiple. I know this is possible with a listbox but this will look ugly on the ui. Is there a way to also have a dropdown with multiple selection and not to advance...

EFCore is incapable of connecting to DB despite everything else being able to

Mystifying me because - SSMS connects fine - Migration commands like Add-Migration "Add_Table" and Update-Database work fine ```PM> Add-Migration "Update02" Build started......

C# help

I'm new to c# and i got this assignment dued in a few hours
No description

Mock UserManager in unit tests (Student)

How should I mock the UserManager class when I want to make tests for a service which has the UserManager as a dependancy? In my test i need to create an instance of TripsService: ```c# public class TripService...

Hosting Blazor Server

I've made this little blazor server web app that I need hosting for. Its gonna be low traffic with a single form on there. I want to host it on my personal computer, and I am okay with keeping it on 24/7 while I need it on, and am okay with occasionally updating whatever I need to update whenever my IP address changes. I need to have ssl and use my custom domain I have from namecheap. How difficult is this? I know IIS exists but that is the extent of my knowlege. If its really difficult or ann...

TCP Help again...

Hi i got a issue right so like basically i got a listener on a port and i can connect to it write data to it and all, on one .cs form but when i try to do the same from a different .cs file it says its actively refusing the connection??? the code that works is the first photo and the code im using is the second. I wont be using the former in the final code but i want it to work in the latter. the second is the exact same code as the first but it is being actively refused as in the third screen shot. the final screen shot is what it is supposed to do....
No description

How to Improve Long API Call Response Times?

Hey everyone, I have an API call that takes a significant amount of time to compute the result. During the computation, users have to wait until the API responds, which leads to a poor user experience. The calculation uses a parallel approach:...

Docker-compose volume storing image

In my Web API I receive images. These images should be stored, prefferable in my local directory. My project uses docker (compose). I managed to use a volume where the images are getting stored in a folder called unfiltered_images in the docker container. However, the saved images do not appear into my specified folder on my d-drive....

Direction of an object relative to player facing direction

i want to make an object move on its own to the direction my camera is facing. i have managed to make the object move but i cant figure out how to fix the direction , any ideas ?
No description

Issues loading DLL

I'm trying to load a C++ DLL and use it's function GetEngineVersion to get the engine version to find out installed version of the game. I need it to be loaded from Properties.Settings.Default.InstallPath, "LS3DF.dll". I get an error 126 and can't fix it. I can use the DLL function if i use [DllImport] but that only uses fixed path. I need it to be dynamic and load the path from InstallPath setting. i'm using .NET Framework 4.7.2, platform is set to x86 ...

ASP.NET Versioning, Folders or Solutions

As the title reads I was wondering if when I introduce versioning to my REST API, if i should use version folders (like a v1, v2, v3 folder in my Controllers root folder) or if i should make seperate solutions in 1 project for versioning and how much sense that makes, considering this will be a very large scale project

Jwt authorization returning 401 every time

I'm trying to add authentication & authorization to my app using jwt tokens, even after generating the token and logging in I still get a 401 Unauthorized error in swagger, I have 0 clue what's happening.

Can't run monogame project on arch linux

I keep getting an error whenever I run dotnet build

What is the best way to edit a form loaded from Assembly?

basically i don't want to modify the dll itself.
```c# Assembly assembly = Assembly.LoadFrom("Form.dll"); Type type = assembly.GetType("Main.frmMain"); Form form = (Form)Activator.CreateInstance(type);...

✅ Downloading file with HttpClient does not work

Hello, Everywhere it is advisable to use HttpClient for downloading larger files. For some reason it only downloads a little chunk of a larger file, and that's it. How should I even determine what the problem is? ...

Unidentifiable Crash with ASP.NET

Hello Folks, I am using a ASP.NET Razor Pages and MS SQL Server to create a Basic CRUD website. Within this website there is a Page that allows the user to directly import data from a Excel File (with EPPlus) to the Database. However, Following a Reinstall of MS SQL Server, the Import Data page is crashing the website with No specific Errors or Exceptions. The Log always shows Exit Code -1 (0xffffffff) and even with Exception logging in multiple places, it is coming up Empty. I have also tried with Previous versions I have saved but with the same issue. The Crash always occurs when you Click the Browse button and then Close the file explorer either by Selecting a File or just Canceling the operation....

BitBlt Not returning image

I am using the Windows API to call bitblt from gdi32.dll and when I call it it doesn't return an image just an empty bit map ``` public Bitmap GetScreenShot() {...