C
C#2y ago
joy

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
Saber
Saber2y ago
the path is probably relative to your current page. Try ~/NoteApp/Scripts/note.js
jcotton42
jcotton422y ago
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
joy
joy2y ago
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?
jcotton42
jcotton422y ago
Just seems kinda weird to me Now NoteApp can't move its scripts around without breaking SimpleApp
joy
joy2y ago
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!
Want results from more Discord servers?
Add your server
More Posts
Change Visual Studio suggetions with custom analysersHiya.. ohh discords new "forum" channels are super useful for this huh?. anyway. So I managed to impProgram won’t run with just .net runtime [Answered]So my program that I published and is targeting .net 6 won’t run when the pc has just .net 6 runtimeNullReferenceException Object reference not set to an instance of an object```cs List<Effects> effectsList = activePlayerEffects[targetPlayer] ?? new List<Effects>(); ``` someDbContext.SaveChangesAsync has no effect on the collection of changed objectsHi. I get products collection from dbContext, change some values and want to save it in the databaseWindowsIdentity claims don't include all AD attributes, how do I fix that?I'm using windows authentication and want to display a user's full name, however on inspection the ihow to create a jwt for an existing user in identityI am looking to create a new JWT and validate it... for using tiwht signalr. so i want to know how tNeed help finding memory leak [Answered]We have a solution with a mix of VB and C# projects. Most of them in VB. We have a logger factory wrEF 6 - Creating entity with n-n```cs PostDtoWrite_2 newpost = new PostDtoWrite_2(); newpost.Title = request.Title; newpHow can I make invisible Console NOT winformI have a project but i need to make invisible, but i can not to make it.namespace missing imports after copying class [Answered]Hi guys, I am struggling with a problem for a few weeks. So I have a ASP.NET Website project (Not w