看我在web.config的配置信息:
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>
后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ajax;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(_Default), this.Page);
}
[Ajax.AjaxMethod()]
public bool CheckUser(string wd)
{
DataTable dt = MainClass.LoadData.GetData(wd);
if (dt.Rows.Count > 0)
{
return false;
}
else
{
return true;
}
}
}
前台调用代码:
<script>
function Check(a)
{
var b =_Default.CheckUser(a).value;
if(b)
{
//document.getElementById ("msg").innerText =a+"可以注册";
alert("可以");
return false;
}
else
{
//document.getElementById ("msg").innerText =a+"不可以注册";
alert("不可以");
return false;
}
}
</script></head>
<body>
<form id="form1" runat="server">
<div>
<input id="Text1" type="text" onblur="return Check(this.value);" />
</div>
<div id="msg">
</div>
</form>
</body>
在本机F5运行没有问题。发布后,在IIS里浏览就有问题了。 究竟是哪的问题 ?请教。。
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>
后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ajax;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(_Default), this.Page);
}
[Ajax.AjaxMethod()]
public bool CheckUser(string wd)
{
DataTable dt = MainClass.LoadData.GetData(wd);
if (dt.Rows.Count > 0)
{
return false;
}
else
{
return true;
}
}
}
前台调用代码:
<script>
function Check(a)
{
var b =_Default.CheckUser(a).value;
if(b)
{
//document.getElementById ("msg").innerText =a+"可以注册";
alert("可以");
return false;
}
else
{
//document.getElementById ("msg").innerText =a+"不可以注册";
alert("不可以");
return false;
}
}
</script></head>
<body>
<form id="form1" runat="server">
<div>
<input id="Text1" type="text" onblur="return Check(this.value);" />
</div>
<div id="msg">
</div>
</form>
</body>
在本机F5运行没有问题。发布后,在IIS里浏览就有问题了。 究竟是哪的问题 ?请教。。
IIS提示AJAX未定义
而VS2008调试状态下是可以的未定义说明找不到那个AJAX的类
我感觉是路径错误,但确实没有解决该问题
希望高手来赐教!