Bom dia!
Estou testando um exemplo de PageMethods, não está funcionando, copiei um exemplo da net igualzinho e mesmo assim não funciona, vejam:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TestandoPageMethods._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script type="text/javascript">
function Testar() {
PageMethods.Testar();
}
</script>
<body onunload="Testar()">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
</form>
</body>
</html>
E o code behind....
Imports System.Web.Services
Public Class _Default
Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
<WebMethod()> Public Sub Testar()
HttpContext.Current.Application.Count.ToString()
End Sub
End Class
Erro: PageMethods não está definido.
Onde está o erro??
Obrigado.