Question

I am using url routing in my asp .net 4.0 application.

And I am using following referrence to call my javascript file.Its working fine in my devenv but when i Host in IIS .my javascript function in the file are not implemented

         <script type='text/javascript' src='<%= ResolveClientUrl("~/js/MYValidations.js") %>'></script>
<link rel="stylesheet" type="text/css" href="../css/style.css"  runat="server" />


I am getting this error

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). [HttpException (0x80004005):

Was it helpful?

Solution

Try this

start the code block with <%# instead of <%= :

<script type="text/javascript" src='<%# ResolveUrl("~/js/MYValidations.js") %>'></script>

or

<script type="text/javascript" src='<%# ResolveClientUrl("~/js/MYValidations.js') %>"></script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top