asp net cshtml javascript file
hi all, i have an asp net project (SimpleApp) and in a cshtml file of my SimpleApp project i tried to refer a javascript file from another project deployed using IIS under NoteApp name
<script src="/NoteApp/Scripts/note.js"></script>
but i can't seem to use the javascript file, but when i tried to hover the full path of this <script src="/NoteApp/Scripts/note.js"></script> that's displayed on the screen (check using developer tools) the fullpath is shown, however the file is not working and only working if i included full path for example <script src="192.168.1.11/NoteApp/Scripts/note.js"></script>, can anyone help advise why?
5 Replies
the path is probably relative to your current page. Try
~/NoteApp/Scripts/note.js
Referencing a JS file from a completely separate site doesn't seem like the greatest idea
Even if you can get it to work
It's anchored with a starting /, so it should only be relative to the domain
okay can, i'll try this out.
sorry.. is it because there's another reason (security issue etc..) or because it's a bad practice?
Just seems kinda weird to me
Now NoteApp can't move its scripts around without breaking SimpleApp
i see, yeah i'll try to remove the scripts i retrieved
actually i get the NoteApp view (include the scripts from NoteApp) using javascript and trying to append the NoteApp view into my SimpleApp file
i'll try either to edit the path or delete the scripts i retrieved..
thank you so much both for your advice!