user1084319
user1084319

Reputation: 299

Web address virtual directory breaks external javascript link so it cannot find the files

so i have a little problem my webadress looks a little like this:

http://localhost:23425/dynamicName/Home.aspx

the dynamicName part well....will be dynamically named. So because of that it breaks my

<script type="text/javascript" src="Scripts/jquery.js"> </script>

scripts since it can't find it. however if its

http://localhost:23425/Home.aspx

then the javascript works.

So my question is how can i get the javascript to work on the dynamic virtual directory and not have my links be broken?

i've tried this :

<script type="text/javascript" src="<%=ResolveClientUrl("~/Scripts/Menu.js")%>"> </script>

with the script links and the css links but it doesn't seem to do it. just a grey box drops down with no content. Any help will be extremely apprectiated

Upvotes: 1

Views: 494

Answers (1)

BNL
BNL

Reputation: 7133

Try:

<%=ResolveUrl("~/Scripts/Menu.js") %>

ResolveClientUrl creates a path which includes ../. That may be your problem.

Upvotes: 2

Related Questions