The difference between Razor Content Pages vs View Pages is that Content Pages are supposed to be called directly, if you don’t want that you should be using a View Page in /Views instead.
Otherwise you’d need to use a register a PreRequestFilter that inspects the incoming request and returns a Forbidden response or something.