Search code examples
c#asp.net-mvcasp.net-mvc-4solution-explorer

Files saved in folder are always excluded in solution explorer in MVC 4


I have switched to c# from php, so little bit confused.I have a problem while saving image to the folder in MVC4.

There is a scenario where I need to save the image to the image folder in MVC4.The image is getting saved to folder but it is excluded.Every time to use this image I need to include this file. Please provide me the solution.Have tried in google and other blogs but I could'nt find out the solution.

The scenario is the registration process where I need to save the user image and show it when it gets login.But due to the fact that the image is excluded,the link seems to be broken or no image can be seen untill the image gets included from the solution explorer.


Solution

  • Files saved in folder are always excluded - is not a problem. Probably you are providing the wrong path or inaccessible path to the image src.

    When ever you are uploading the Images / Files - always you no need to include the file into your solution. Its a wrong approach.

    The Problem is locating the Image file from the Html. The Given Path is the Problem, not including / excluding.

    Solution to check the Image Path:

    1. Load the web page in Chrome browser.
    2. Right Click on the Image.
    3. And Open the Image in New Tab.
    4. Check the URL of your Image. Which is loaded.

    Check out this Article.