حل خطأ ‘MsAjaxBundle’ is not a valid script name

عندما تقوم بإنشاء موقع ب ASP.NET 4.5 ، وتقوم بتحديث المكتبات ، يظهر لك هذا الخطأ
‘MsAjaxBundle’ is not a valid script name.  The name must end in ‘.js’ ، الخطأ غريب والبحث لا يفيد بالكثير ، ولكن إليكم الحل.

سبب المشكلة هو تحديث ajaxToolkit إلى الإصدار الجديد بحيث تدعم المنصة 4.5 ، ولحل هذه المشكلة عليك فتح صفحة Site.Master  والذهاب إلى الجمل التالية :

 <asp:ScriptManager runat="server">
<Scripts>
<%--Framework scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="jquery.ui.combined" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />

<asp:ScriptReference Name="WebFormsBundle" />
<%--Site scripts--%>

</Scripts>
</asp:ScriptManager>

يجب علينا تحديث ال ScriptManager ، وتحتاج إلى القيام ب 3 خطوات
1- استبدل asp:ScriptManager ب ajaxToolkit:ToolkitScriptManager
2- امسح السطر المحترم الذي به MsAjaxBundle  ، لانها لا تلزم كليا
3- قم بحذف المواصفة System.Web من كل الأسطر

أي أن الخلاصة ستكون كالتالي

 <ajaxToolkit:ToolkitScriptManager  runat="server">
<Scripts>
<%--Framework scripts--%>
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="jquery.ui.combined" />
<asp:ScriptReference Name="WebForms.js" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Path="~/Scripts/WebForms/Focus.js" />

<asp:ScriptReference Name="WebFormsBundle" />
<%--Site scripts<asp:ScriptReference Name="khjs.js" Assembly="System.Web" Path="~/Scripts/khjs.js" />--%>

</Scripts>
</ajaxToolkit:ToolkitScriptManager>

يا راجل كان من الأول حطيت النص النهائي بدال ما تتتتتتتتتتعبت عينينا واحنا بنقرأ بالخطوات ، شو أعمل أنا ! هيك المخرج بده.

بالتوفيق

About the author

خليل سليم

Leave a Comment

هذا الموقع يستخدم Akismet للحدّ من التعليقات المزعجة والغير مرغوبة. تعرّف على كيفية معالجة بيانات تعليقك.