Reputation: 5480
I am looking at an older asp.net 2.0 web application. In the master page, there are the following tags:
<link href="style/template.master.css" rel="stylesheet" />
<script src="js/prototype.js" type="text/javascript"></script>
When I saw this, I expected some trouble with pages loading from folders within the site. I was not expected there to be a difference in how the relative URLs are being resolved. Below is a screenshot of the resolved URLs from a page in the Admin folder:
I expected the URLs to both be resolved relative to the Admin folder; but as can be seen, the URLs resolved differently. My question is why?
An explanation is fine, but I would really like a reference of the resolution rules that state the difference -- or of a bug that could causing this.
A bit more info:
There are no base
tags in either the admin page or master page.
The behavior is the same in both IE 11 (in various compatibility modes) and Chrome 40.
The master page has an XHTML 1.0 Strict doc type.
Thanks
Upvotes: 2
Views: 136
Reputation: 11222
The head section in master pages usually have a runat="server"
attribute and there is an 'Automatic URL Resolution in the <head> Section'
, this fixes the URLs for any link tags, but not for the script tags.
Why? don't know. Here's an article about URLs in Master Pages.
For a reference, you could look at the source, now that asp.net is open source.
Upvotes: 2