Baybars Bay

Baybars Bay

  • NA
  • 73
  • 3k

Show profile picture when user is logged in and editing user informa

Dec 6 2020 11:10 AM
Hello friends
 
I want the user picture to appear in the upper right corner when the user logs in and edit user information from there
 
please I am waiting for your help
 
I can show the username but I couldn't succeed the others
sample picture: 
  1. public ActionResult Index()  
  2. {  
  3. if (Session["User_ID"] != null)  
  4. {  
  5. return View(db.UserViewModel.ToList());  
  6. }  
  7. else  
  8. {  
  9. return RedirectToAction("LogIn","UsersInfo");  
  10. }  
  11. }  
  12. public ActionResult LogIn(Models.UsersInfo user)  
  13. {  
  14. if (IsValid( user.User_Name, user.Password ))  
  15. {  
  16. FormsAuthentication.SetAuthCookie(user.User_Name, false);  
  17. Session["User_ID"] = user.User_ID.ToString();  
  18. Session["User_Name"] = user.User_Name.ToString();  
  19. return RedirectToAction("Index","Photos");  
  20. }  
  21. else  
  22. {  
  23. ModelState.AddModelError("""Login details are wrong.");  
  24. }  
  25. return View(user);  
  26. }  
  1. <li class="nav-item">  
  2. @if (Session["User_ID"] != null)  
  3. {<text>  
  4. Welcome @Session["User_ID"].ToString() </text>  
  5. <img src="@Html.ViewData["UserPicturePath"]" alt="Images" height="48" width="48" />  
  6. }  
  7. <li class="nav-item">  
  8. @if (Session["User_Name"] != null)  
  9. {<text>  
  10. Welcome @Session["User_Name"].ToString() </text>  
  11. }  
  12. </li>  

Answers (1)