Search code examples
asp.net-mvcasp.net-mvc-2spark-view-engine

Spark show logged in user


How do I show the username of the person logged in within a Spark View?

The default MVC view engine had a Page object that you could get the info from.

How would I do that in spark?

I know that I could put the info into the viewdata dictionary, which is probably the best, but I don't want to have to write

ViewData["User"] = myUser;

before I return from EVERY action method.

I'd like some feedback


Solution

  • Thanks for making me look at the properties again.

    I found the user object in

    Context.User
    

    within the Spark View. It doesn't have a page object, but it does have what I need. :)