Hi All,
I'm not expert asp.net developer but my customer ask me why Ajax seems doesn't works on IIS 7.5 environment with application pool setted to Classic 2.0 framework and Ajax.dll loaded in my bin directory. When I call ajax function, Internet Explorer return a "_default' is undefined " like if _default class is not recognized
Below you'll can see three pages, default.aspx - default.aspx.vb and web.config:
default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="_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>Ajax Test Page</title>
<script type="text/javascript">
function ini()
{
alert ("This is only ajax test");
_default.test(_callback);
}
function _callback (response)
{
alert (response.value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="javascript:ini();">Click here</a><br />
</form>
</body>
</html>
default.aspx.vb
Imports Ajax
Partial Class _Default Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim a As String
Ajax.Utility.RegisterTypeForAjax(GetType(_Default))
End Sub
#Region "Funcions Ajax"
<Ajax.AjaxMethod(HttpSessionStateRequirement.ReadWrite)> _
Public Function test() As String
Return 1234
End Function
#End Region End Class
web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration> <appSettings /> <connectionStrings /> <system.web>
<httpHandlers> <add verb="POST,GET" path="Ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" /> </httpHandlers> <compilation debug="true" strict="false" explicit="true" /> <pages> <namespaces> <clear /> <add namespace="System"
/> <add namespace="System.Collections" /> <add namespace="System.Collections.Specialized" />
<add namespace="System.Configuration" /> <add namespace="System.Text" />
<add namespace="System.Text.RegularExpressions" /> <add namespace="System.Web" />
<add namespace="System.Web.Caching" /> <add namespace="System.Web.SessionState" />
<add namespace="System.Web.Security" /> <add namespace="System.Web.Profile" /> <add namespace="System.Web.UI" /> <add namespace="System.Web.UI.WebControls" /> <add namespace="System.Web.UI.WebControls.WebParts" />
<add namespace="System.Web.UI.HtmlControls" /> </namespaces> </pages> </system.web> <system.webServer> <httpErrors errorMode="Detailed" /> </system.webServer> </configuration>
Thanks for reply