I am trying to print the name of the user who executes my web app. It is written in MVC-Razor.
From the initial View, I would to execute the controller below:
[Authorize]
public ActionResult Check()
{
var check = new CheckAD();
var user = new User {Name = check.CheckSecurityWithAD()};
if (!string.IsNullOrEmpty(user.Name))
{
return View("Checked", user);
}
var errors = new ErrorsModel()
{
Messages = new List<string>(){"You don't have permission"}
};
return View("Error", errors);
}
This controller returns another view if the user is correctly authenticated:
@model UsersActivationWeb.Models.User
@{
ViewBag.Title = "Checked";
}
@{ <p> Logged come @Model.Name </p>};
How can I print the second view (I think it's a partial view) in the first one using the controller?
Thanks
@html.Partial("ViewName")