• About
  • Privacy Policy
  • Utilities
Darchuk.NET

ASP.NET

ASP.NET Core 2.2 SignalR Server

July 12, 2019 by Robert 1 Comment

SignalR is a technology that allows you to write bi-directional communication between a server and a client.  This can lead to some pretty cool interactions, such as a live-updating dashboard on a website, or the ability to communicate requests to a server without building HTTP endpoints.  SignalR does a lot of heavy lifting behind the … [Read more…]

Posted in: .NET Core, ASP.NET, C#, SignalR, Web Development Tagged: .NET Core, ASP.NET, C#, Realtime, SignalR, Web Development

ASP.NET Core Unit Testing – Setting the request body

June 28, 2019 by Robert Leave a Comment

Every now and again I find it necessary to set up the request body manually (as opposed to using the [FromBody] tag).  In the controller you can read from the request body easily enough: via GIPHY Testing How do you test this?  Normally I would just create a controller, call the method, and check the … [Read more…]

Posted in: .NET Core, ASP.NET, C#, MVC, Unit Testing, Web API, Web Development Tagged: ASP.NET, ASP.NET Core, Csharp, unit testing, Web Development

ASP.NET Core Web API–Returning a FileStream

May 31, 2019 by Robert 3 Comments

So I built a service that collects information, say, log information, and sends it down to a client.  This information is normally streamed right to a web browser via SignalR, but sometimes there is a lot of it, and scrolling through it on the web view can be quite a pain.  It would be nice … [Read more…]

Posted in: .NET Core, ASP.NET, C#, Web API, Web Development Tagged: ASP.NET, C#, File Download, Stream, WebAPI

ASP.NET Core 2–Enabling SignalR logging

April 19, 2019 by Robert 1 Comment

Sometimes you just need some logging to do a sanity check that things are actually working the way that you’re expecting. via GIPHY Here’s how to turn logging on in ASP.NET Core 2 for SignalR: I’ve had to look this up more than twice, and its not exactly easy to find in the Microsoft docs, … [Read more…]

Posted in: .NET Core, ASP.NET, C#, Debugging, SignalR Tagged: .NET Core, ASP.NET, C#, Logging, SignalR

ASP.NET Core – Unit Testing a file upload

March 29, 2019 by Robert 1 Comment

Last week I wrote about how to upload a file from a website using Angular and .NET Core.  Writing tests for this is mostly straightforward, but there’s a few gotchas that I thought I would write down for the next time I need to do this.  The front end tests are pretty trivial – you … [Read more…]

Posted in: .NET Core, C#, Unit Testing, Web API, Web Development Tagged: .NET Core, ASP.NET, ASP.NET Core, File Upload, IFormCollection, IFormFile, Testing, unit testing

Uploading a file from a website

March 22, 2019 by Robert 1 Comment

Uploading a file from a website is pretty simple, but I always have to look it up.  There’s all sorts of different technologies and frameworks that work with the web, so I just thought I would write down how I got it to work so that next time I can just come back here and … [Read more…]

Posted in: .NET Core, Angular, ASP.NET, C#, JavaScript, Typescript, Web API, Web Development Tagged: .NET Core, Angular, ASP.NET, File, MemoryStream, Typescript, Upload, Web API

.NET Core WebApp–Set Port on Command Line Launch

February 22, 2019 by Robert Leave a Comment

There are a bunch of different ways to do this, but sometimes I find myself wanting to run multiple web applications locally on different ports without fussing with configuration files, etc.  And whenever I need to do this, I always have to look it up… but most of the posts out there are how to … [Read more…]

Posted in: .NET Core, ASP.NET, Web Development Tagged: .NET, .NET Core, ASP.NET, C#, WebAPI

CORS in ASP .NET Core 2.2

December 21, 2018 by Robert Leave a Comment

Recently my team upgraded to .NET Core 2.2.  We have an API that needs to be accessed from an Angular project living in a different domain, so we had CORS enabled this way: Disclaimer: this is an intranet application – so it is only accessible inside of a corporate firewall, making it more acceptable to … [Read more…]

Posted in: .NET Core, ASP.NET, C#, Security, Web API, Web Development Tagged: .NET Core, ASP.NET, C#, CORS, NETCORE, Security, WebAPI

C# Mapping an Enum to a key value pair

May 18, 2018 by Robert 2 Comments

Enums are useful because they help you avoid magic numbers.  You can write your code in a way that is easy to read and understand from the human’s perspective, which, at the end of the day, is pretty important. Exposing enums on your Web API I want to share my enums with other things, notably … [Read more…]

Posted in: .NET Core, ASP.NET, C#, Typescript, Web API, Web Development Tagged: .NET, Angular, ASP.NET, C#, enum, Typescript, Web API

ASP.NET MVC — Unit Testing IActionResult

April 13, 2018 by Robert Leave a Comment

In the last post I talked about using and extending IActionResult to return your preferred HttpStatus code in your ASP.NET MVC controllers.  But how do you write unit tests that make sure that you’re returning what you expect?  Your controllers will return one of these: IActionResult There’s nothing on this interface that you can easily … [Read more…]

Posted in: .NET Core, ASP.NET, C#, MVC, Unit Testing, Web API, Web Development Tagged: .NET Core, ASP.NET, C#, Controller, IActionResult, MVC, unit testing, XUnit
1 2 Next »

Recent Posts

  • Allowing trailing JSON commas in ASP.NET Core 3
  • YADNC3JSG–Yet Another .NET Core 3.0 JSON Serializer Gotcha
  • Logging in a .NET Core 3 SignalR client
  • .NET Core 3 unit testing project sdk
  • .NET Core 3.0 Upgrade–New JSON Serializer Gotchas

Recent Comments

  1. Robert on C# Setting Socket Keep-Alive
  2. Oliver Schramm on C# Setting Socket Keep-Alive
  3. John Anderson on Waiting for a keypress asynchronously in a C# console app
  4. Ronald Garlit on .NET Core 3 unit testing project sdk
  5. Ronald Garlit on .NET Core 3 unit testing project sdk

Copyright © 2025 Darchuk.NET.

Omega WordPress Theme by ThemeHall