skip to Main Content

I cannot see the image tec.png on Print.cshtml but same image is visible on PrintBos.cshtml

cshtml files

My image path

Print.cshtml code

<th>
        <img style="
             width:60%;
             "src="..imgtec.png">
    </th>

printBos.cshtml code

<th>
        <img style="
             width:60%;
             "src="..imgtec.png">
    </th>

As I can see,they are the same. What might be the reason?

Edit: I realized that images are shown on the default page only and using ~ doesn’t work. Image file contents are not encrypted.

2

Answers


  1. Chosen as BEST ANSWER

    I deleted the .. and it worked

     <th>
                <img style="
                     width:60%;
                     "src="imgtec.png">
            </th>
    

  2. It is likely that the path to the image file is incorrect or the file is missing in the location specified.

    You can try out the following steps may it help you out,

    Verify that the path to the image file is correct in the Print.cshtml file. Also check for any typos or mistakes in the file path.

    Next check if the image file exists or not for this go to the location specified in the Print.cshtml file and verify if the image file actually exists or not. If it does not, either upload the file or update the file path in the Print.cshtml file.

    Also verify the format of the file because we need to make sure that the image file is in a format that can be displayed in a web page (such as PNG, JPG, or GIF).

    As a last step check even if the image file exists, but image is still not visible, check the file permissions to ensure that it is accessible to the web server.

    If these steps do not help and the issue is still there, you may need to further check out the code and configuration of your web application to find out the root cause.

    Thanks.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search