向asp.net母版页添加自定义脚本时出现语法错误

时间:2015-06-08 13:10:26

标签: asp.net

我正在尝试在我的母版页上添加jQuery和Bootstrap脚本,但它不起作用,我收到语法错误。

  

SCRIPT1002 asp.net无法添加任何脚本

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="TicketDeskMain.master.cs" Inherits="TicketDesk.TicketDeskMain" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <asp:ContentPlaceHolder ID="HeadContentPlaceHolder" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="AjaxScriptManager" runat="server" />
        <div>....</div>
    </form>

    <ticketDesk:KeepAlive ID="KeepAlive1" runat="server" />
    <ticketDesk:KeepAlive ID="KeepAliveScript" runat="server" />
    </form>

    <script src="jquery-1.3.2.min.js"></script> <!-- HERE I've added a script -->
</body>
</html>

1 个答案:

答案 0 :(得分:0)

yep, that works quite well so, i've found a solution of that problem

<script type="text/javascript" src="<%= Page.ResolveUrl(@"~/Scripts/jquery-1.3.2.min.js") %>"></script> just write this line at the end of masterpage: and in web.config this: <location path="Scripts"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location>