A Razor view is actually a template that is transformed into a class that inherits from RazorPage<T>. The generic parameter is actually the type of model, as we will see in a moment. This class inherits from RazorPage, which exposes a few useful properties, as follows:
- IsLayoutBeingRendered (bool): Whether a layout page is currently being rendered or not
- BodyContent (IHtmlContent): The resulting page's body contents; will only be available at a later time
- TempData (ITempDataDictionary): The temporary data dictionary
- ViewBag (dynamic): Access to the view bag, which holds arbitrary data prototyped as dynamic
- User (ClaimsPrincipal): The current user, as in HttpContext.User
- Output (TextWriter): The output writer, to which the HTML results are sent once the page is processed
- DiagnosticSource (DiagnosticSource): Allows the logging of diagnostic messages, covered here ...