Not found the view when creating protected MVC add-on

Vote:
 

Hi guys,

I created public MVC EPiServer add-on for EPiServer 8 and it's working fine. I tried to change this add-on to protected add-on but it wasn't working. The view or its master was not found or no view engine supports the searched locations.

Can any guys help me, plz? 

Thanks a lot,

#123723
Jul 17, 2015 4:18
Vote:
 

Could you provide more details like stack trace and some sample code?

How do you reference that view and master? Do you resolve some path in controller code?

#123727
Jul 17, 2015 10:33
Vote:
 

I tried to change Razor template to ASPX-view for MVC but it is still working if I set it as public modude and not working with protected module.

Here is detail error: 

Stack Trace: 

[InvalidOperationException: The view '/manage/NISJoinCMS.InDesignIntegration.UI/Views/PrintTemplates/Index.aspx' or its master was not found or no view engine supports the searched locations. The following locations were searched:
/manage/NISJoinCMS.InDesignIntegration.UI/Views/PrintTemplates/Index.aspx
/manage/NISJoinCMS.InDesignIntegration.UI/Views/Shared/Site.Master]
   System.Web.Mvc.ViewResult.FindView(ControllerContext context) +430
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +144
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +800560
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +800560
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +800560
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +787916
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

And here is a code section on my controller:

public ActionResult Index()
{
            //Bind template list to model
            var templateList = _printTemplateService.List();
            var vr = View(Paths.ToResource(GetType(), "Views/PrintTemplates/Index.aspx"), templateList);
            vr.MasterName = Paths.ToResource(GetType(),"Views/Shared/Site.Master");
            return vr;
}

My addon's target framework is .NET4.5.

I have already added web.config into Views folder.

I haven't resolve it yet. Have you find out any reason with my problem?

Thanks for your help,

#123732
Jul 17, 2015 14:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.