문제

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):

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top