Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7783843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:57:38+00:00 2026-06-01T19:57:38+00:00

In visual studio virtual server this works. But when I put site on IIS

  • 0

In visual studio virtual server this works. But when I put site on IIS it doesn’t display images from content folder.

    var imgPath = '/Content/Images/Icons/' + icon + '.png';
                var imageContent = '@Server.MapPath(Url.Content("-1"))';
                image = imageContent.replace('-1', imgPath);

I get errors in browser foreach image

http://localhost/Content/Images/Icons/carwash.png Failed to load resource: the server responded with a status of 404 (Not Found)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:57:40+00:00Added an answer on June 1, 2026 at 7:57 pm

    First thing is first, are you sure that all of your ‘icons’ are part of the solution and are actually being deployed to your web server? I have had a few instances where I would add a file to the solution directory and VS does not automatically include in it the solution, thus it never actually gets deployed…

    If that is ok and the images are actually there, my next question would be, have you tried just using the @Url.Content helper in your view to determine if that is working as it should?

    <img src="@Url.Content("~/Content/Images/Icons/SomeIcon.png")"/>
    

    EDIT

    Since you are trying to accomplish this in Javascript and the above tag works in HTML, you should be able to condense that code up there to the following code:

    var image = '@Url.Content("~/Content/Images/Icons/")' + icon + '.png';
    

    Go ahead and let MVC get the path to the Icon folder and append your file and extension to that. This should eliminate the need for string replacement and still be able to process the icon paths in JS.

    var image will now be the complete relative path to the icon file you have passed to this function. You can use this string to update and img src tag or create an image or whatever.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just installed Visual Studio 2008 on a Virtual PC to evaluate it
I have visual studio 2008 running on a Windows 2008 virtual PC. I decided
I want to create a Windows 7 64-bit (Ultimate) virtual machine with: Visual Studio
Visual Studio 2008 insists on indenting HTML like this: <h1> title</h1> <h2> subtitle</h2> where
Visual studio 2005: I am moving from post build event to using the external
I build sites in .NET without using Visual Studio. Are virtual includes the right
Server 2008 machine with SP1, Visual Studio 2008 with SP1. My user; Developer, is
I'm using Visual Studio's built in web server to test and EPiServer applicaiton. When
I have a virtual machine running windows 2003 server running MOSS 2007. This virtual
I'm using VS 2010 and a using IIS Express instead of the Visual Studio's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.