Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net DataRepeater\u ItemCommand事件在一段时间后停止触发_Asp.net_Vb.net_Events_Datarepeater - Fatal编程技术网

Asp.net DataRepeater\u ItemCommand事件在一段时间后停止触发

Asp.net DataRepeater\u ItemCommand事件在一段时间后停止触发,asp.net,vb.net,events,datarepeater,Asp.net,Vb.net,Events,Datarepeater,好吧,这是我最近看到的最奇怪的事情 我正在使用VS studio 2010构建一个asp.net(framework 4.0)网站。我的代码在VB.Net中,我的测试浏览器是Firefox(最新版本),也在IE8和Google Chrome上测试过,同样的行为 基本上,我在UpdatePanel中的DataRepeater中有一个LinkButton。 只要我定期(每隔几分钟左右)使用页面,_ItemCommand事件就会触发 问题是这样的:当我打开另一个网页(在另一个浏览器选项卡中)并在上面坐

好吧,这是我最近看到的最奇怪的事情

我正在使用VS studio 2010构建一个asp.net(framework 4.0)网站。我的代码在VB.Net中,我的测试浏览器是Firefox(最新版本),也在IE8和Google Chrome上测试过,同样的行为

基本上,我在UpdatePanel中的DataRepeater中有一个LinkButton。 只要我定期(每隔几分钟左右)使用页面,_ItemCommand事件就会触发

问题是这样的:当我打开另一个网页(在另一个浏览器选项卡中)并在上面坐上大约1个小时,然后在浏览器选项卡中返回测试页面并单击链接按钮时,不会触发任何事件,页面会重新加载。就像我的纽扣刚扣死一样


我首先指出这可能是会话超时问题,但我将SessionID记录在一个文本文件中,会话不会过期 我在谷歌上搜索了一下,发现有相当多的人因为AVG链接扫描仪而有类似的行为


首先,我要感谢JHSOWTER指出我的初始会话超时检测逻辑有缺陷。这真的让我回到了正确的轨道上

所以问题是,由于应用程序池回收,我的会话超时了

标准SessionTimeout解决方案无法工作,因为我在控制应用程序池超时的共享主机上

解决方案是将以下行添加到Web.Config文件中(在
标记中):


为了生成我的机器密钥标签,我使用了以下工具:

在这些改变之后,我所有的问题都消失了


再次感谢您的帮助。

“我将会话ID记录在一个文本文件中”-这如何确保会话没有超时?我认为默认超时是20分钟,因此如果您等待了一个小时,并且您的文本文件说会话没有超时,并且您没有在web.config中更改超时,那么我认为您的日志记录没有执行您认为它正在执行的操作。会话ID存储在cookie中,cookie的aspnet_sessionId值将被重新用于后续会话,即使它们在服务器端超时。。。我的印象是每一次新的会议都会有一个新的会议ID。。。这就是它在当地的表现。。。我尝试将会话超时增加到120分钟。。。还是没有快乐。我知道即使我将会话超时设置为120,某些服务器设置可能会覆盖此设置。。。有没有人能帮我检查会话是否过期的好主意?jhshowter,谢谢你的提示。顺便说一句。你认为会话超时会导致这种“死按钮”行为吗?用页面标记和ItemCommand事件发布你的代码。如果您想知道会话何时超时,请将其登录到Global.asax文件中。这可能与会话有关,但这取决于代码的功能。将检查、测试并报告。谢谢。禁用了我的AVG链接扫描仪,仍然没有乐趣。请与我的主人联系,看看他们是否在服务器上运行AVG。如果我知道更多,我会向你汇报。
If Context.Session IsNot Nothing And Context.Session.IsNewSession _
    And Page.Request.Headers("Cookie") IsNot Nothing _
    And Page.Request.Headers("Cookie").IndexOf("ASP.NET_SessionId") >= 0 Then

    'SESSION HAS TIMEDOUT
End If
<asp:UpdatePanel ID="udpRSSFeeds" runat="server" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="cmdSearch" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="drpNewsFeed" EventName="ItemCommand" />
        <asp:AsyncPostBackTrigger ControlID="cmdViewAll" EventName="Click" />
    </Triggers>
    <ContentTemplate>

        <table class="Borderless" cellpadding="0" cellspacing="0"  style="width:100%">
        <tr><td class="lblHeaderText">NEWS FEEDS</td></tr>

        <%--BEGIN: SEARCH GIZMO--%>
        <tr><td>
            <table class="Borderless" style="width:100%;" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="text-align:right; vertical-align:middle; height:32px;" >
                        <asp:TextBox ID="tbxSearchBox" runat="server" MaxLength="50" AutoCompleteType="None" Font-Size="16px" style="height:20px; width:187px; font-size:16px; border-style:solid; border-color:#54d242;" onfocus="Javascript:this.focus();this.select();" ></asp:TextBox>
                    </td>
                    <td style="text-align:left; vertical-align:middle; width:150px; height:32px;" >
                        <asp:ImageButton ID="cmdSearch" ImageUrl="~/GUIImages/cmdSearch.jpg" ToolTip="Search feed(s) for keyword(s)." Height="26px" Width="26px" runat="server" BorderStyle="None" ImageAlign="Middle" />
                    </td>
                </tr>
            </table>
        </td></tr>
        <%--END: SEARCH GIZMO--%>

        <%--BEGIN FEED LIST--%>
        <tr><td style="padding:3px 0px 3px 0px;"><asp:LinkButton ID="cmdViewAll" runat="server" CssClass="MenuItemActive" PostBackUrl="" CausesValidation="false" Text="* View ALL RSS Feeds"></asp:LinkButton></td></tr>                        
        <asp:XmlDataSource ID="xdsNewsFeed" runat="server" DataFile="App_Data/RSSFeeds.xml" XPath="dataroot/qryRSSFeed"></asp:XmlDataSource>
        <asp:Repeater ID="drpNewsFeed" runat="server" DataSourceID="xdsNewsFeed" EnableViewState="true" >
            <ItemTemplate>
                <tr><td style="padding:3px 0px 3px 0px;">
                    <asp:LinkButton ID="cmdSelectNewsFeed" runat="server" CssClass="MenuItem" CausesValidation="false" CommandName='<%#XPath("ID")%>'>- <%#XPath("Title")%></asp:LinkButton>
                </td></tr>
            </ItemTemplate>
        </asp:Repeater>
        <%--END FEED LIST--%>

        <tr><td>&nbsp;</td></tr>
        </table>

    </ContentTemplate>
</asp:UpdatePanel>
Protected Sub drpNewsFeed_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles drpNewsFeed.ItemCommand
    Dim oLogger As New nebLogManager("TESTNWOSGN.txt")

    oLogger.TraceStart("drpNewsFeed_ItemCommand (" & Session.SessionID & ")")

    'some code that never gets run because the event is not fired...

    oLogger.TraceStop("drpNewsFeed_ItemCommand (" & Session.SessionID & ")")
End Sub


Protected Sub cmdSearch_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdSearch.Click
    Dim oLogger As New nebLogManager("TESTNWOSGN.txt")


    oLogger.TraceStart("cmdSearch_Click (" & Session.SessionID & ")")

    'some code that never gets run because the event is not fired...

    oLogger.TraceStop("cmdSearch_Click (" & Session.SessionID & ")")
End Sub
<sessionState timeout="60" cookieless="false" mode="StateServer" />
<machineKey ... />