asp.netviewresult

ViewResult and lookup directories


new ViewResult() { ViewName = "Error_403" };

in this case .net looks through current controller view directory (~/Views/Home/) and in shared (~/Views/Shared/)

Is there any way to point to specific directory right here ViewName = @"Errors\Error_403"?
Or may be any other simple solutions?


Solution

  • Try something like this:

       New ViewResult(){ViewName="~/Views/SomeDir/Error_403.aspx"};
    

    See here for a similar issue: StackOverflow