I made a simple AJAX page in Visual Studio 2005, which has a button click to get server's system time. It works fine inside the VS2005. But when I put it on IIS in Windows Server 2003, the button click becomes a full postback. Do I miss something? Does anyone have any idea?I wrote a testing Ajax website to get server time in a asp:UpdatePanel and deplyed it to Windows Server 2003 IIS.It worked fine and didn't?happen?to full postback.Here are my sample codes for your reference.Wish this can give you some helps.
<div>
<asp:UpdatePanel ID="upnlServerTime" runat="server">
<ContentTemplate>
<asp:Label ID="lblServerTime" runat="server" Text="Server Time"></asp:Label>
<asp:Button ID="btnServerTime" runat="server" Text="Get Server Time" OnClick="btnServerTime_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnServerTime" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
Behind Code:
protected void btnServerTime_Click(object sender, EventArgs e)
{
Label lblServerTime = upnlServerTime.FindControl("lblServerTime") as Label;
lblServerTime.Text = DateTime.Now.ToLongTimeString();
}
I doubt you don't create web application when you create a virtual directory in IIS.Right mouse click virtual directory in IIS and select Properties,Click "Create" button to create application name and Choose Execute Permission for "Scripts only" or "Scripts Executable" from permission DropDownList.Try to addNetwork Service to virtual directory?when?deploying?Ajax?
website.
Wish this can give you some ideas.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment