Limit the lookup mechanism for accessing certain namespaces in Microsoft MVC

In my C # MVC project, users have access to Views modifications to customize their page views (they can edit cshtml views and use the Razor engine).

How can I limit the browsing mechanism to access to some namespaces, for example System.IO, System.Sql?

I planned to remove "System.XXX" in markup from users, but some namespaces are imported by default, for example System.IO. therefore, users can still run some dangerous commands, such as File.Delete ...

So, how can I limit user access to simple CSHTML editing, and some namespaces are not all namespaces?

+4
source share
1 answer

In This Section: Strange Auto-Import Namespace in My Razor Views

robotnik: So, the answer: In Razor, it displays that some namespaces are always imported. This cannot be disabled in the configuration because it is tightly coupled to the code.

But Nigel Chemling Found the answer that inherits the class from MvcWebRazorHostFactory.

Thanks to every body :)

+2
source

Source: https://habr.com/ru/post/1530662/


All Articles