Skip to main content

56 posts tagged with "asp.net"

View All Tags

Google Analytics API and ASP.Net Core

· 2 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

I recently had need to be able to access the API for Google Analytics from ASP.Net Core. Getting this up and running turned out to be surprisingly tough because of an absence of good examples. So here it is; an example of how you can access a simple page access stat using the API:

ASP.NET Core: Proxying HTTP Requests with an AllowList

· 7 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

This post demonstrates a mechanism for proxying HTTP requests in ASP.NET Core. It doesn't proxy all requests; it only proxies requests that match entries on an "allowlist" - so we only proxy the traffic that we've actively decided is acceptable as determined by taking the form of an expected URL and HTTP verb (GET / POST etc).

Using Reflection to Identify Unwanted Dependencies

· 3 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

I having a web app which is fairly complex. It's made up of services, controllers and all sorts of things. So far, so unremarkable. However, I needed to ensure that the controllers did not attempt to access the database via any of their dependencies. Or their dependencies, dependencies. Or their dependencies. You get my point.

Auth0, TypeScript and ASP.NET Core

· 10 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

Most applications I write have some need for authentication and perhaps authorisation too. In fact, most apps most people write fall into that bracket. Here's the thing: Auth done well is a *big* chunk of work. And the minute you start thinking about that you almost invariably lose focus on the thing you actually want to build and ship.

Setting Build Version Using AppVeyor and ASP.Net Core

· 2 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

AppVeyor has support for setting the version of a binary during a build. However - this deals with the classic ASP.Net world of AssemblyInfo. I didn't find any reference to support for doing the same with dot net core. Remember, dot net core relies upon a <Version> or a <VersionPrefix> setting in the .csproj file. Personally, <Version> is my jam.

Debugging ASP.Net Core in VS or Code

· 4 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

I've been using Visual Studio for a long time. Very good it is too. However, it is heavyweight; it does far more than I need. What I really want when I'm working is a fast snappy editor, with intellisense and debugging. What I've basically described is VS Code. It rocks and has long become my go-to editor for TypeScript.

Instant Stubs with JSON.Net (just add hot water)

· 5 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

I'd like you to close your eyes and imagine a scenario. You're handed a prototype system. You're told it works. It has no documentation. It has 0 unit tests. The hope is that you can take it on, refactor it, make it better and (crucially) not break it. Oh, and you don't really understand what the code does or why it does it either; information on that front is, alas, sorely lacking.

UseStaticFiles for ASP.Net Framework

· 7 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

This is a guide on how not to expose all your static files to the world at large when working with the ASP.Net Framework. How to move from a blocklisting approach to a allowlisting approach.

NgValidationFor Baby Steps

· 4 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

I thought as I start the NgValidationFor project I'd journal my progress. I'm writing this with someone particular in mind: me. Specifically, me in 2 years who will no doubt wonder why I made some of the choices I did. Everyone else, move along now - nothing to see. Unless the inner workings of someone else's mind are interesting to you... In which case: welcome!

Getting more RESTful with Web API and IHttpActionResult

· 3 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

Up until, well yesterday really, I tended to have my Web API action methods all returning 200's no matter what. Successful request? 200 for you sir! Some validation error in the model? 200 for you too ma'am - but I'll wrap up the validation errors and send them back too. Database error? 200 and and an error message.