Implementing queue in c#
<p>I am developing a c# application, in which the server gets requests from many clients at a time. Each client also gets their data from different databases.  In this situation sometimes data leakage is happening, means clients get data from an incorrect database.  Say for example client1 should get data from db1 and client2 gets data from db2.  Instead they get data from opposite databases; client1 gets from db2 and client2 gets from db1.
I am adding the code below where it collects the data.</p>

<pre><code>public string List()
{ 
    Response.ContentType = ContentType.Xml;

    try
    {
        ThingzFilter filter = null;
        Dictionary&lt;string, string&gt; parameters = new Dictionary&lt;string, string&gt;();

        if (Id!="")
        {
            // get parameters from http request
            foreach (HttpInputItem param in Request.Param)
                parameters.Add(param.Name, param.Value);

            setServerURLs();
            //Request.Clear();

            if (Request.QueryString["lang"].Value != null)
            {
                ThingzDB.TzThing.get_language = Request.QueryString["lang"].Value.ToString();
            }
            else
            {
                ThingzDB.TzThing.get_language = SessionDatabase.DefaultLanguage;
            }
        }

        ThingzDatabase db = SessionDatabase;

        langStr = db.Language;

        // this is run if there was no ID supplied
        // which means we want all items of all types
        if (Id == "")
        {
            if (Request.AcceptTypes == null)
            {
                //TypeController.session_id = Request.QueryString["sessionid"].Value;

                jobs.Add(Request.QueryString["sessionid"].Value);
                if (nextJobPos &gt; jobs.Count - 1)
                    return "";
                else
                {
                    TypeController.session_id = jobs[nextJobPos];
                    nextJobPos++;
                    langStr = SessionDatabase.Language;
                }

                filter = new AllThingzFilter(SessionDatabase, parameters, langStr);
                TypeController.session_id = "";
                filter.Execute();
            }
</code></pre>

<p>In this server is console application and clients are windows where the site names , means the databse names are mentioned.
Please give me a solution to overcome this issue.</p>
