I have some actions that are only called from Html.RenderAction and I'd like to prevent these actions from being called directly using a URL.
Is it possible to see that the current request was made from a call to RenderAction? In that case I could create an IActionFilter for that.
A partial view is a Razor markup file ( . cshtml ) without an @page directive that renders HTML output within another markup file's rendered output. The term partial view is used when developing either an MVC app, where markup files are called views, or a Razor Pages app, where markup files are called pages.
To create a partial view, right click on the Shared folder -> click Add -> click View.. to open the Add View popup, as shown below. You can create a partial view in any View folder. However, it is recommended to create all your partial views in the Shared folder so that they can be used in multiple views.
You can use the Html. Raw() method for that.
Add the [ChildActionOnly]
attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With