Update Panel shows data from multiple users RRS feed

  • Question

  • User463812309 posted


    I have a web app with multiple pages relating to performing Exchange tasks for non exchange administrators.

    One of these pages will allow a user to view / add / remove permissions from a mailbox.

    It works fine, but the viewing takes around 40 seconds because of all the calls to exchange cmdlets.

    So, I thought I'd add an Update Panel and provide progress on each step. 

    That works great if only one user uses the page at a time, but if multiple people run it, the data is either combined for both or one person gets the other's data.

    This is my update panel:

     <asp:UpdatePanel ID="pnlResults" runat="server" UpdateMode="Conditional" Visible="false" ChildrenAsTriggers="false">
                    <asp:Label ID="lblResults" runat="server" Height="150px"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtProgress" runat="server" Visible="false" TextMode="MultiLine" BorderStyle="None" Width="95%" Style="overflow: hidden;" AutoPostBack="false"></asp:TextBox>
                    <br />
                    <br />
                    <asp:Table ID="thePermissionTable" runat="server" AutoPostBack="true" BorderStyle="None"></asp:Table>
                    <br />
                    <asp:Button ID="btnRemoveAccess" runat="server" Visible="false" Text="!Remove Access!"></asp:Button>
                    <br />
                    <asp:Button ID="btnBack" Text="Return" runat="server" OnClick="BtnBack_Click" Visible="true" AutoPostBack="true"></asp:Button>
                    <asp:TextBox ID="txtPermissionToRevoke" runat="server" Width="0px" Height="0px" BorderStyle="None"></asp:TextBox>
                    <asp:TextBox ID="txtSendOnBehalf" runat="server" Width="0px" Height="0px" BorderStyle="None"></asp:TextBox>
                    <asp:TextBox ID="txtSendOnBehalfToRevoke" runat="server" Width="0px" Height="0px" BorderStyle="None"></asp:TextBox>
                    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />

    This is timer1_tick:

    protected void Timer1_Tick(object sender, EventArgs e)
            if (inProcess)
                txtProgress.Rows = content.Split('\r').Length + 1;
                txtProgress.Text = content;
            if (processComplete && content.Substring(content.Length - processCompleteMsg.Length) == processCompleteMsg) //has final message been set?
                inProcess = false;
                btnNext.Visible = false;
                btnBack.Visible = true;
                txtProgress.Text = content;
                if (tableDone)
                    if (rdoAction.SelectedValue.ToString().ToLower() == "remove-access")
                        pnlButtons.Visible = true;
                        btnRemoveAccess.Visible = true;
                    thePermissionTable.Visible = true;
                Timer1.Enabled = false;
                if (displayTable)
                if (rdoAction.SelectedValue.ToString().ToLower() == "remove-access")
                    pnlButtons.Visible = true;
                    btnRemoveAccess.Visible = true;

    I start the process with my button click in RaisePostBackEvent like so:
                       switch (action)
                            case "display-access":
                                Timer1.Enabled = true;
                                inProcess = true;
                                pnlButtons.Visible = false;
                                Thread workerThread = new Thread(new ThreadStart(() =>

    FnGetCurrentAccess() does almost all of the exchange cmdlets by calling my commonfunctions class, and adds to the content which is a private static string.

    I have no idea how to make this work, so I appreciate any ideas.


    Wednesday, March 31, 2021 10:23 PM

All replies

  • User-939850651 posted

    Hi Karl Mitschke,

    Based on the information you provided, I am still confused about the problem. Because it contains a lot of unknown controls or variables (such as button RaisePostBackEvent , rdoAction), I am not sure of their specific role in the execution process, so I'm afraid I can't determine your current problem. 

    If possible, could you describe your problem more clearly? And sample code that can reproduce the problem?

    Best regards,

    Xudong Peng

    Thursday, April 1, 2021 4:28 AM
  • User409696431 posted

    "FnGetCurrentAccess() does almost all of the exchange cmdlets by calling my commonfunctions class, and adds to the content which is a private static string."

    Static strings retain their values across user sessions.  All users will see the same value in that string, and all users will be adding data to the same string.

    Don't use a static string.  Use storage specific to the user.   I don't know how your code works, but typically it would be session or just a string, not a static string.  If you use a string, you'll need to pass it to your functions.

    Friday, April 2, 2021 11:00 PM
  • User276797048 posted

    controls are a central part of Ajax functionality in ASP.NET. They are used with the ScriptManager control to enable partial-page rendering. Partial-page rendering reduces the need for synchronous postbacks and complete page updates when only part of the page has to be updated. Partial-page rendering improves the user experience because it reduces the screen flicker that occurs during a full-page postback and improves Web page interactivity.

    I often find the controls implementation causes more problems then it is worth. So I often implement my own Ajax services, to handle such logic. You can do this the old school way, quite easy.

    // Create .aspx page, to be our service. 
    public class ControlUpdateService
         protected void Page_Load(object sender, EventArgs e)
              // Use an approach to determine which control type, and model to build.         
              // You would build your object, then use Newtonsoft.Json, to serialize, then
              // return the object, via Response.End(object). 

    Then your page would Ajax the data, hit the service, then build your control via the .success in the Ajax call. If you do this approach, you commit to saving your data via Ajax as well. Keep that in mind. As I was answering this question, I can't help but feel your problem actually stems from the control doing an AutoPostback. Which you can actually disable.

    AutoPostBack = "false";

    Telerik may be different, but the documentation should clearly indicate how to disable this feature. Which would eleminate your need for an UpdatePanel all together. Allowing you to save your data, on PostBack correctly.

    Friday, June 18, 2021 9:51 AM