質問

ユーザーがダウンロードファイルからASP.NET 申請には、セッション終了数秒後にダウンロードファイルです。前のセッションが切れるまでのタスクを実行でき、その後約5~10秒のセッションを再起動してログイン取得します。

私が簡単なページを発揮します。走このページを新規作成asp.net c#プロジェクト、そしてinsertのコードを新しいページです。

編集: これIE7の問題です。FirefoxやChromeに影響はありません。

このコードのセッションを再開です:

HttpContext.Current.Response.ContentType = "text/xml";
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=test.xml");
HttpContext.Current.Response.Write("<test>this is a test.</test>");
HttpContext.Current.Response.End();

再現にこの問題:

  1. コピーを下記のコードは、asp.net ページです。
  2. IE(使ったIE7、firefox、chromeんがこの問題)
  3. このセッションです。
  4. リフレッシュのページこのセッションは新しいものではない。
  5. ダウンロードファイルとして保存することができます。
  6. ヒットの"リフレッシュページ"ボタンを数回までの"セッションは新しい"テキストが再表示され(約10秒)。

以下のコードは、次のとおりです簡単なレクリエーション:

<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <script runat="server">
        private string sessionString {
            get {
                return HttpContext.Current.Session["sessionString"] == null ? null : HttpContext.Current.Session["sessionString"].ToString();
            }
            set {
                HttpContext.Current.Session["sessionString"] = value;
            }
        }
        protected void Page_Load(object sender, EventArgs e) {
            Label1.Text = sessionString ?? "Session is null";
            if(sessionString == null) {
                Label1.Text = "Session is new";
                Label1.BackColor = System.Drawing.Color.Red;
                sessionString = "Session is now not null";
            }
            else {
                Label1.Text = sessionString;
                Label1.BackColor = System.Drawing.Color.White;
            }
        }
        protected void LinkButton1_Click(object sender, EventArgs e) { }
        protected void LinkButton2_Click(object sender, EventArgs e) {
            HttpContext.Current.Response.ContentType = "text/xml";
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=test.xml");
            HttpContext.Current.Response.Write("<test>this is a test.</test>");
            HttpContext.Current.Response.End();
        } 
    </script>
    <form id="form1" runat="server">
    <div>
        <asp:Label id="Label1" runat="server" text="Label"></asp:Label> <br />
        <asp:LinkButton id="LinkButton1" runat="server" onclick="LinkButton1_Click">Refresh Page</asp:LinkButton> <br />
        <asp:LinkButton id="LinkButton2" runat="server" onclick="LinkButton2_Click">Download File</asp:LinkButton> <br /><br />
        <b>Steps to recreate:</b>
        <ol>
            <li>Download the file and save it.</li>
            <li>Hit the "Refresh Page" button a couple of times until the "Session is new" text is redisplayed.</li>
            <li>Answer my question explaining what the heck is going on!</li>
        </ol>
    </div>
    </form>
</body>
</html>
役に立ちましたか?

解決

まれることが期待され ることができます同様の問題)?う利用フィドラーズつか詳細は問い合わせ

他のヒント

確認から始まり新鮮なブラウザで後からの脱却までを使用します。Clear()する。私は同じ問題のあること、とくにに応じます。Clear()ただいた後に廃棄され、ブラウザはあなたがオマージングを楽しむことができ、新鮮なインスタンス.幸運を祈っています。

Hm.が入っているのか、それともその Response.Clear() 食べるセッション状態cookie?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top