locked
ASP.Net Core MVC BaseController RRS feed

  • Question

  • User135423268 posted

    Good Day I'm trying to create a base controller on my ASP.NET Core Web Application, I'm currently migrating my applications from .Net Framework to .Net Core, but this code on my base control is not working.

    protected override void Initialize(System.Web.Routing.RequestContext requestContext)
    {
        base.Initialize(requestContext);
    
        string GetString = "Test";
         Viewbag.GetString = GetString;
        }
    }

    The reason for this I have to send the "ViewBag.GetString" to the Layout page for my razor codes, I tried to search it to the internet, but all the answers either it's on the .Net  or things that is complicated to understand (for me). I hope someone can help me on this

    Thanks and regards

    Friday, December 4, 2020 3:21 AM

Answers

All replies