Quantcast
Channel: Genuine Scope » ajax
Viewing all articles
Browse latest Browse all 7

Server Error in ‘/Application Name’ Application

$
0
0

When I was trying to call a pagemethod in aspx file, it gave me an error like Server Error in ‘/Application Name’ Application.

This type of page is not served.

Description: The type of page you have requested is not served because it has been explicitly forbidden. Please review the URL below and make sure that it is spelled correctly.

Requested URL: Url for the pagemethod

The screenshot of this error has been shown below.

Server Error in '/Application Name' Application

Server Error in ‘/Application Name’ Application

In the console it says Failed to load resource: the server responded with a status of 403 (Forbidden)

  • How I got this error :

I will explain when I got this this error, then you can easily understand the situations where this kind of errors may occur.

  • Functionality :

I was trying to load feeds in a web page like loading notifications when the web page goes down in facebook.And there was a “view more” button if this loading stops in the middle, then the user can use this button to load more feeds.

So loading feeds when page goes down was really ok.But I had a pop up in my web page.So when I clicked on the pop up and goes down the web page, it gave me this error
and pagemethod was not found.

  • Solution for this error :

So I had to use plain AJAX and call my webmethod as below.

In javascript call webmethod in the aspx file as below.


function viewmoreFeed() {
 pageIndex = 1;
 $.ajax({
 type: 'POST',
 contentType: "application/json; charset=utf-8",
 url: 'Feed.aspx/GetFeeds',
 data: "{'pageIndex':'" + pageIndex + "'}",
 async: false,
 success: function (response) {
 document.getElementById("loadmoreclick").innerHTML = response.d;
 //alert(response.d);
 }

 

});

}

In aspx file,

 [WebMethod]
 public static string GetFeeds(int pageIndex)
 {

//write your functionality here
 }

That’s all.Now its working perfectly. Cheerssssss… :)

Share


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images