Prevent Content Pages being browsed

I have a content page (not a View) Stuff.cshtml located at Folder1/Stuff.cshtml in my web project.

Is it possible to prevent a user from browsing to it directly?
(i.e. they get 404 if the browse to http://myserver/Folder1/Stuff)

[I am rendering the content page internally in my app)

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.

Got it, will switch over to views then