@Url. Content issues

Source: Internet
Author: User

First question:

@Url. Content Reference Issues


<script src= "@Url. Content (" ~/scripts/artdialog/jquery.artdialog.js?skin=blue ")" Type= "Text/javascript" > </script>

<script src= "~/scripts/artdialog/jquery.artdialog.js?skin=blue" ></script>

Today wrote an MVC demo, the folder structure is very simple, as follows: The use of EF to generate the model framework and manually add table field annotations, but on the page JS verification is always not displayed. There is no language. Inadvertently press F12 in the browser, see prompt: Failed to load resource:the Server responded with a status of 404 (not Found) http://localhost:1445/~/Scripts/jquery. Validate.min.js Failed to load resource:the Server responded with a status of $ (Internal server Error) HTTP://LOCALHOST:1445/~/SCR Ipts/jquery.validate.unobtrusive.min.js%22estimation is the path of the path JS file problem, hurriedly looked at the following layout.cshtml view:

Sure enough, the 11,12,13 line of code runs when it is mapped to:

There is a problem with the mapped physical path. The actual jquery is in the root directory of the website, and no longer under the test folder!

Remove these lines of error and use the @url.content () function map to convert the virtual (relative) path to the application absolute path.

PS: To use the MVC automatic verification, in addition to the model write annotations, introduce jquery-1.5.1.min.js, but also to pay attention to whether the introduction of jquery.validate.js. From the name can be learned, that is the set of JS authentication method. The default MVC3 empty project and the _layout.cshtml of the Internet do not refer to jquery and validate.js. (The post refers to the original author address: http://www.cnblogs.com/nlh774/p/3594666.html)

Second question:

<script src= "@Url. Content (" ~/scripts/artdialog/jquery.artdialog.js?skin=blue ")" Type= "Text/javascript" > </script>

<script src= "@Url. Content (" ~/scripts/artdialog/jquery.artdialog.js ")" Type= "Text/javascript" ></script >

And whether the "? Skin=blue" difference is added to the path:

Recently in doing a project there is no suffix directly resulting in a bullet box exception as follows:

It should have been shown as follows:

To record the issue.

@Url. Content issues

Related Article

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.