Javascript and CSS links are broken when hosting inside an existing website

190 views Asked by At

I have a ASP.Net application. I have master page and normal pages. In my master page I have referenced .js & .css like below,

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

[The scripts folder is in same directory only]. It has working well in my local machine and also it is working well after hosting the site in IIS as normal website. The application is going to be part of the existing website which is going to be host under one website.

After hosting it the application launched successfully but the .js & .css files are not loading even I am facing issue when Response.Redirect

Please help me out to host my application under a website.

1

There are 1 answers

2
Win On

In ASP.Net WebForm, you can use one of the following approach -

<script src="~/Scripts/Application/Menu.js" type="text/javascript"></script>

Or

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