Ramon Ortega

Ramon Ortega

  • 2.1k
  • 37
  • 1.4k

How to display user picture base on the username in ASP MVC?

Jan 31 2022 11:38 PM

Hi guys i have this problem how can I display the picture of the user base on the username when the pictures is in the Network Folder \\10.10.25\\AquariusImages\IdPictures\rortega.jpg 

This is the js function

//DTR functions
DTR.init = function () {
    user = $("#user").text();
    username = $("#username").text();
    userIdEmployee = $("#userIdEmployee").text();

   if  ($('#userGender').text() == "Female") {
       else {



DTR.SetUserData = function () {
        url: "/Modules/FetchUserData",
        type: "GET",
        data: {
            username: username
        dataType: "json",
        success: function (data) {
            for (var i in data) {

This part is for the Header.cshtml where the user picture thumbnail is located

 <div class="col-md-4">
                <div class="pr-5 text-white" style="font-size:14px;font-weight:bolder">
                    <span id="imageProfileMale" style="display: none;">
                        <img src="~/image/default_male.png" style="width:40px" />
                    <span id="imageProfileFemale" style="display: none;">
                        <img src="~/image/default_female.png" style="width:40px" />
                    <span id="imageProfileRortega" style="display: none;">
                        <img src="~/image/rortega.jpg" style="width:40px" />
                    <span id="userGender" hidden>@ViewBag.UserGender</span>
                    <span id="userIsApprover" hidden>@ViewBag.IsApprover</span>
                    <span id="user" style="text-transform: capitalize;">@ViewBag.User</span>
                    <span id="username" style="text-transform: capitalize;" hidden>@ViewBag.Username</span>
                    <span id="userIdEmployee" hidden>@ViewBag.IDEmployee</span>


how can I display the user picture guys? please help

Answers (1)