Search code examples
c#asp.netasp.net-mvc-3asp.net-mvc-3-areas

How To Hide Edit Page


Hi people am trying to hide the edit page in MVC3 C# so when a user trys to enter "Edit" in the browser some form of page comes up informaing the user this is not allowed.

If you require more information please ask

Thank You


Solution

  • I suggest setting up redirects in your config file. Add the following to system.web in your web.config file and update the redirect path to whatever you want to redirect to..

      <customErrors mode="On" defaultRedirect="Error">
          <error statusCode="302" redirect="Error/PageNotFound" />
          <error statusCode="404" redirect="Error/PageNotFound" />
          <error statusCode="403" redirect="Error/AuthorizationError" />
        </customErrors>