Search code examples
c#jqueryasp.net-mvc-5aspnetboilerplate

Create new view for Account Controller


I'm Trying to implement a Email Activation action.

I successfully added Action to Controller and it get called when I access the URL: /Account/EmailActivation

AlsoCreated the corresponding View file as /Views/Account/EmailActivation.cshtml.

But, when app start to render, the main _ViewStart.cshtml is used instead of /Views/Account/_ViewStart.cshtml.

It causes app to raise errors.

What I'm missing?

#AccountController 
public class AccountController : cadastroControllerBase
{
    ...

    public ActionResult EmailActivation()
    {
        return View("EmailActivation");
    }

OBS: I'm using ABP (ASP.NET Boilerplate) with ASP.NET MVC 5 & jQuery


Solution

  • Well,

    After changing the return of EmailActivation action as below, everything worked as expected:

    public ActionResult EmailActivation()
    {
        ViewBag.IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled;
    
        return View("EmailActivation", 
                new EmailActivationFormViewModel
                {
                    ReturnUrl = Request.ApplicationPath,
                    IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled,
                    IsSelfRegistrationAllowed = IsSelfRegistrationEnabled(),
                    MultiTenancySide = AbpSession.MultiTenancySide
                });
    }