I have migrated database and web app to azure and done the proper connection string as well but in my code which I have published All the Images in web app in UI are not showing because it is hard code and given the path of C: Drive

Ashraf Khan 20 Reputation points


No Images are showing in my app service but while running in IIS server its working proper in visual studio

Azure SQL Database
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,362 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 19,706 Reputation points

    If your images are part of your project and are deployed alongside your web app, you should use relative paths instead of absolute paths. This ensures the images can be accessed regardless of the deployment environment.

    For a more scalable solution, you can store your images in Azure Blob Storage and update your code to reference these images.

    Steps to Use Azure Blob Storage:

    1. Create a Blob Storage Account:
      • Navigate to the Azure Portal.
      • Create a new Storage Account or use an existing one.
      • In the Storage Account, create a Blob container and upload your images.
    2. Update Your Code:
      • Modify your image URLs in the web app to point to the Blob Storage URLs.
      • Example URL: https://<storage-account-name>.blob.core.windows.net/<container-name>/<image-name>
    3. Access Control:
      • Ensure the Blob container has the appropriate access level (public access if the images should be publicly accessible).