Click here to Skip to main content
15,843,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
        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:

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

var parameters = { arrFilters: FilterArray, arrFilterCondition: FilterConditionArray };
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) {

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

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

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":""}
Updated 5-Aug-21 8:10am

1 solution

Did you got answer yet?

Please post it here.

thank you
Share this answer
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