c# - MVC Single Sign On: How to get Userdata from DB before the page is going to be loaded -


i have following issue:

i working on built of intranet webpage single sign on. in home controller, before index page going loaded, take windows username of user via

system.environment.username 

then connect database , information (like department , lastname, fullname) of user.

these information stored in public variables , shown in navbar. use razor , write in section of layout:

<li class="user-header">     <img src="~/dist/img/profile.png" class="img-circle" alt="user image">         <p>@projectname.controllers.homecontroller.username            <small>@projectname.controllers.homecontroller.department</small>        </p> </li> 

so there picture of user (avatar) , there should stay firstname, lastname , department.

but here problem. works if user types in url home page (localhost order localhost/home).

but if types in example (localhost/dashboard) homecontroller not going invoked , area, username , department should stay, empty (see attachments).

target: should looks this, no matter point user accesses page.

this how @ moment, when site not accessed through homecontroller.

so can give me hints, how should proceed realize target? have spend 3 days fix "bug", no bug.

thank in advance!


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -