WebResource.axd and ScriptResource.axd Get Method Failed
-
11-12-2019 - |
Вопрос
I have been searching around here and elsewhere on the internet searching for a solution, and have wasted too much time on this. Keep in mind I am fairly new to web design and am self taught. It is possible I just completely missing something.
When I click the but who calls the CallMeMaybe() function I will get the "Starting 1" and "passed test 1" alerts only. So my pagemethods gethello() I am assuming is not getting called, or at least not doing anything.
function CallMeMaybe() {
var dest;
// call server side method
alert("Starting 1");
if (typeof (PageMethods) == "undefined") {
alert("Not Working");
}
else {
alert("passed test 1");
var prm = Sys.WebForms.PageRequestManager.getInstance();
PageMethods.GetHello(CallSuccess, CallFailed, dest);
}
alert("Sent");
}
function CallSuccess(res, destCtrl) {
alert("success");
var dest = document.getElementById(destCtrl);
alert(res);
var str = "";
var table_result = "<table border='1'>";
for (var i = 1; i < res.length - 1; i++) {
str += (res[i] + "<br />");
table_result += "<tr><td><img src='Images/img" + i + ".jpg' alt='' width='100' height='100'/></td></tr>";
}
table_result += "</table>";
//document.querySelector('#results').innerHTML += str;
document.querySelector('#results').innerHTML += table_result;
}
// alert message on some failure
function CallFailed(res, destCtrl) {
alert(res.get_message());
}
When I run the Developer Tools in Chrome I get this:
If any of you could help me or point me into the right direction that would be awesome! Like I said I have wasted too much time trying to figure this out and finally decided to come here to ask for help.
Решение
Found my problem! I had to add the following code to my Web.config file:
<system.webServer>
<handlers>
<add name="ManifestHandler" verb="*" path="*.manifest" type="TestWebSvc.ManifestHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" verb="*"/>
</handlers>
</system.webServer>