The path of the file referenced on the Asp.net motherboard page

Source: Internet
Author: User

1. image problems

Excellent solution

With runat = "server" added, the PATH uses the absolute path ~ /It is basically OK.

2. CSS file reference

<LINK rel = "stylesheet" type = "text/CSS" href = "style.css"/>

The magic here is that the href of The Link file is automatically adjusted with the directory structure of the accessed file. To put it bluntly, you can consider the path referenced by the master page.

For example, if the master page referenced by XXX. aspx in a folder under the same directory on the master page, the preceding statement automatically becomes

<LINK rel = "stylesheet" type = "text/CSS" href = "../style.css"/>

The premise is that

3. js file reference

<SCRIPT type = "text/JavaScript" src = "menu/jquery. Min. js"> </SCRIPT>

In this case, the client will not be able to reference the page files in other directories.

So you need to handle it like this

<SCRIPT type = "text/JavaScript" src = '<% = resolveurl ("menu/jquery. Min. js") %>'> </SCRIPT>

<SCRIPT type = "text/JavaScript" src = '<% = resolveclienturl ("menu/ddsmoothmenu. js") %>'> </SCRIPT>

There are two methods, and the path on the client will be different, respectively:

<SCRIPT type = "text/JavaScript" src = '/tlerp/menu/jquery. Min. js'> </SCRIPT>

<SCRIPT type = "text/JavaScript" src = '../menu/ddsmoothmenu. js'> </SCRIPT>

Obviously, resolveclienturl is a relative path, which is relatively easy to use. Of course, resolveurl also requires such an absolute path in many places, where tlerp is the name of a Web application.

In addition, if youCodeIn

Control contains code blocks (that is, <%... %>), so the control set cannot be modified.

The reason is that you can put the referenced content in <body>, even between <body> and <form>.

 

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.