Image path after Asp.net MVC is released to IIS

Source: Internet
Author: User

ASP. MVC has been released for some time and has only recently started learning.

Environment: Windows 7 (iis7.5), vs2008 + SP1, Asp.net MVC 1.0 official version

Problem: after being published to IIS, the image cannot be displayed.

label images cannot be displayed, and images in the style sheet can still be displayed.

Before release:

After release:

 

ProblemCodeAs follows:

<% = URL. Content ( " ~ /Content/AAA/1.jpg " ) %>

//MVC 1.0 generates HTML code "/content/AAA/1.jpg"

//HTML code generated by MVC2 preview 2 "/Demo/Content/AAA/1.jpg" added the virtual directory name

//Publish to IIS virtual directory name: Demo

 

Before release: http: // localhost: 3229/content/AAA/1.jpg can be accessed

Http: // localhost: 3229/Demo/Content/AAA/1.jpg cannot be in the range

After the release: http: // localhost/content/AAA/1.jpg cannot be accessed

Http: // localhost/Demo/Content/AAA/1.jpg can be accessed

 This article is not the essence, because the problem is urgent,Send it to the homepage (remove the homepage after resolution)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.