Click here to Skip to main content
15,077,641 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
Hello,
        I have created visual web part for fetching data from SharePoint list and display on it.
For fetching data from list I have used server object model. For fetching data from SharePoint list I have created "Application Page" and written code in it.  
     In application page I have mentioned the method as a "[WebMethod]".I am calling application page method by using Ajax (i.e. from Sample.ascx page).
On search button I have written code for calling Application Page method "GetFilterResults" by using Ajax.
Problem is that when I click on search button it is giving error 500 Internal Server error that is Ajax is not calling "GetFilterResults" method it jumps to the "error method of Ajax".
   One thing to mention is that, the code is working fine on Development, System Test and UAT environment only it is not working on "Production" environment.
  Below is the sample code in Visual Web Part page (i.e. in Sample.ascx page).


What I have tried:

C#
//Call Ajax function for getting filter condition results from Content Metadata Master List               

var parameters = { arrFilters: FilterArray, arrFilterCondition: FilterConditionArray };
$.ajax({
type: "POST",
async: false,
url: "/_layouts/15/BulkWorkflow/BulkWorkflowCode.aspx/GetFilterResults",
data: JSON.stringify(parameters),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
	
var data1 = jQuery.parseJSON(response.d)

for (var i in data1) {

 alert(data1[i].ContentID + ", " + data1[i].ContentName + " , " + data1[i].ContentTitle);	

}
},
error: function (xhr, ajaxOptions, thrownError) {
alert("Error");
alert(xhr.status);
alert(thrownError);
}
});

C#
And code in Application page (i.e. in BulkWorkflowCode.aspx page),


C#
[WebMethod]
public static string GetFilterResults(string[] arrFilters, string[] arrFilterCondition)
{
	
	//Code for fetching data from SharePoint list and return output as a String
}


C#
also I have checked the error logs in  Fiddler tool 


it is giving following error,

{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}
Posted
Updated 5-Aug-21 7:10am
v2

1 solution

Did you got answer yet?

Please post it here.

thank you
   
Comments
Dave Kreskowiak 5-Aug-21 13:16pm
   
You posted your question as a solution to a 5 year old question. You are unlikely to get an answer.

Why? Because a 500 error means the server-side code failed for some reason. It's so generic an error that there is no way for anyone to tell you what's wrong based only on that information.

Go to the Quick Answers menu above and click "Ask a question", then provide proper details on what the problem is and the code that's causing it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900