1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Globalization;
\r
17 using System.Web.Mvc.Resources;
\r
19 public class ViewResult : ViewResultBase {
\r
20 private string _masterName;
\r
22 public string MasterName {
\r
24 return _masterName ?? String.Empty;
\r
27 _masterName = value;
\r
31 protected override ViewEngineResult FindView(ControllerContext context) {
\r
32 ViewEngineResult result = ViewEngineCollection.FindView(context, ViewName, MasterName);
\r
33 if (result.View != null) {
\r
37 // we need to generate an exception containing all the locations we searched
\r
38 StringBuilder locationsText = new StringBuilder();
\r
39 foreach (string location in result.SearchedLocations) {
\r
40 locationsText.AppendLine();
\r
41 locationsText.Append(location);
\r
43 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture,
\r
44 MvcResources.Common_ViewNotFound, ViewName, locationsText));
\r