How to pass values from One controller to another Controller in ASP.Net MVC3

后端 未结 4 723
青春惊慌失措
青春惊慌失措 2021-01-14 08:19

Hello In my project I have to pass a welcome message with username to the Index Page Its a MVC3 ASP.Net Razor project

There are two controllers are there; O

4条回答
  •  春和景丽
    2021-01-14 09:22

    You could retrieve the currently authenticated username from the User instance:

    [Authorize]
    public ActionResult Index()
    {
        string username = User.Identity.Name;
        ...
    }
    

提交回复
热议问题