Make a Controller Protected in MVC

No, we cannot make a controller protected.

Let's try to make a controller protected.

Output:


home controller

When we make the controller private, protected or protected internal, it is giving a compiler error, but when we make the controller internal let's see what happens.

build program

Let's run the application and see the output.

server error in application

Let's make the controller public and run the application.

run the application

Happy Coding.


Similar Articles