Thậm chí tôi có cùng một vấn đề mà tôi đã giải quyết như dưới đây.
Sau khi tải lên tệp Nếu bạn chuyển hướng đến same page
hoặc some other page in your project
thì vấn đề này sẽ tránh được.
Ví dụ:
Trong ASPX My
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm.aspx.cs" Inherits="WebApplication.WebForm" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</div>
</form>
</body>
</html>
Thậm chí tôi đã nhận cùng một vấn đề tôi đã giải quyết như dưới đây.
Sau khi tải tệp lên Nếu bạn chuyển hướng đến cùng một trang hoặc một số trang khác trong dự án của bạn. Sau khi phản hồi chuyển hướng sẽ không có ở đó khi bạn đã chuyển hướng.
Trong ASPX My
Trong C của tôi thơ ca ngợi Đằng sau
public partial class WebForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string path = Server.MapPath("~");
path = path + FileUpload1.FileName;
FileUpload1.SaveAs(path);
Response.Redirect("WebForm.aspx"); // Responce will be cleared. This Redirection will do the Trick
//Put the debugger and check it will work
}
}
Ở đây, để hiển thị sự thành công và thông báo lỗi cố gắng sử dụng phiên.
Tôi đã hỏi một số điều tương tự trong khi quay lại ... http://stackoverflow.com/questions/305684/how-can-i-prevent-database-being-written-to-again-when-the-browser -oes-a-reload – Marty