当前位置:编程学习 > C#/ASP.NET >>

vs2005ajax用不了

原来是用 vs2008的,并装有ajax。最近由于项目需要,需用vs2005开发,但在用的时候发现ajax不起效。
我重新下载了跟vs2005匹配的ajax,装好。但是用还是不起作用,这是为什么?
例子:<body>
<form id="form1" runat="server">
<div>
 <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:Timer ID="Timer1" runat="server" Interval="100" OnTick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>

并在.cs文件中写入事件 
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
运行,但无任何效果,为什么这是? --------------------编程问答-------------------- 配置文件? --------------------编程问答-------------------- 在配置文件里面增加一段代码

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
--------------------编程问答--------------------
要改config

新建网站-》ajax页面-》自动生成一个新的可以使用ajax的web.cofig

跟你以前的对比一下 --------------------编程问答-------------------- 配置文件 --------------------编程问答--------------------
引用 2 楼 fengyarongaa 的回复:
在配置文件里面增加一段代码

C# code

<httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory……

要在配置文件加这些!不然2005的AJAX不起作用
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,