.net 用服务器控件写的aspx和apsx.cs程序,按F5后提示数据将重复提交,如何破解?

.net 用服务器控件写的aspx和apsx.cs程序,按F5后提示数据将重复提交,如何破解?

如何破解?? 你用的Form表单提交,就会出现这个问题。你会Ajax异步提交数据么?? 用Ajax异步提交数据方便很多,而且不会出现这个现象呢。不懂的话百度吧!!!

提交后Response.Redirect到另外的页面,或者改为ajax之类的刷新提交

试试能不能用 IsPostBack属性判断或控制

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





<form id="form1" runat="server">


/asp:ScriptManager


    <br />





    <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Italic="False" 
        Font-Overline="False" Font-Size="XX-Large" ForeColor="#0066FF" 
        Text="财务个险佣金凭证处理平台"></asp:Label>
    <br />
    <br />
    <br />
    机&nbsp;&nbsp; 构:&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;
    <asp:DropDownList ID="DropDownList1" runat="server" Height="25px" Width="112px">
        <asp:ListItem Value="6501">乌鲁木齐</asp:ListItem>
        <asp:ListItem Value="6502">克拉玛依</asp:ListItem>
        <asp:ListItem Value="6521">吐鲁番</asp:ListItem>
        <asp:ListItem Value="6522">哈密</asp:ListItem>
        <asp:ListItem Value="6523">昌吉</asp:ListItem>
        <asp:ListItem Value="6527">博州</asp:ListItem>
        <asp:ListItem Value="6528">巴州</asp:ListItem>
        <asp:ListItem Value="6529">阿克苏</asp:ListItem>
        <asp:ListItem Value="6530">克州</asp:ListItem>
        <asp:ListItem Value="6531">喀什</asp:ListItem>
        <asp:ListItem Value="6532">和田</asp:ListItem>
        <asp:ListItem Value="6599">奎屯</asp:ListItem>
        <asp:ListItem Value="6540">伊犁</asp:ListItem>
        <asp:ListItem Value="6542">塔城</asp:ListItem>
        <asp:ListItem Value="6543">阿勒泰</asp:ListItem>
        <asp:ListItem Value="6590">石河子</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <br />
    用 户 名:&nbsp; <asp:TextBox ID="TextBox1" 
        runat="server" Height="24px"></asp:TextBox>
    <br />
    <br />
    <br />
    密&nbsp; 码:&nbsp;&nbsp; 
    <asp:TextBox ID="TextBox2" runat="server" 
        ontextchanged="TextBox2_TextChanged" Height="24px" TextMode="Password"></asp:TextBox>
    <br />
    <br />
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" Text="登陆" Height="25px" 
        onclick="Button1_Click" Width="73px" />
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="Button2" runat="server" Text="清空" Height="25px" Width="73px" 
        onclick="Button2_Click" />
    <br />
    <br />

</div>
</ContentTemplate>

/asp:UpdatePanel

</form>



/asp:ScriptManager


    <br />

    <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Italic="False" 
        Font-Overline="False" Font-Size="XX-Large" ForeColor="#0066FF" 
        Text="财务佣金凭证处理平台"></asp:Label>
    <br />
    <br />
    <br />
    机&nbsp;&nbsp; 构:&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;
    <asp:DropDownList ID="DropDownList1" runat="server" Height="25px" Width="112px">
        <asp:ListItem Value="6501">乌鲁木齐</asp:ListItem>
        <asp:ListItem Value="6502">克拉玛依</asp:ListItem>
        <asp:ListItem Value="6521">吐鲁番</asp:ListItem>
        <asp:ListItem Value="6522">哈密</asp:ListItem>
        <asp:ListItem Value="6523">昌吉</asp:ListItem>
        <asp:ListItem Value="6527">博州</asp:ListItem>
        <asp:ListItem Value="6528">巴州</asp:ListItem>
        <asp:ListItem Value="6529">阿克苏</asp:ListItem>
        <asp:ListItem Value="6530">克州</asp:ListItem>
        <asp:ListItem Value="6531">喀什</asp:ListItem>
        <asp:ListItem Value="6532">和田</asp:ListItem>
        <asp:ListItem Value="6599">奎屯</asp:ListItem>
        <asp:ListItem Value="6540">伊犁</asp:ListItem>
        <asp:ListItem Value="6542">塔城</asp:ListItem>
        <asp:ListItem Value="6543">阿勒泰</asp:ListItem>
        <asp:ListItem Value="6590">石河子</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <br />
    用 户 名:&nbsp; <asp:TextBox ID="TextBox1" 
        runat="server" Height="24px"></asp:TextBox>
    <br />
    <br />
    <br />
    密&nbsp; 码:&nbsp;&nbsp; 
    <asp:TextBox ID="TextBox2" runat="server" 
        ontextchanged="TextBox2_TextChanged" Height="24px" TextMode="Password"></asp:TextBox>
    <br />
    <br />
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" Text="登陆" Height="25px" 
        onclick="Button1_Click" Width="73px" />
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="Button2" runat="server" Text="清空" Height="25px" Width="73px" 
        onclick="Button2_Click" />
    <br />
    <br />

</div>
</ContentTemplate>

/asp:UpdatePanel