.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Multiple Paramatized Threading issue

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

I need the funcitonality to have two methods run concurrently of each other and the parent thread (aka the method that makes these two calls) to halt until BOTH are done. After the threads are done, I need to perform logic on the returns of the method, so it is essential for both of them to be complete before the parent thread continues. I have searched the internet and tried varous attacks, and I always come up with the same result, this being the parent thread continues operation after the first thread finishes, leaving the second thread running.  Can someone show me a quick example of how I can do this. I have tried checking states of the threads, halting the threads, but I always end up with the same thing. Any help would be great. Thanks.

View Complete Post

More Related Resource Links

Multiple Paramatized Threads



I have a  method that calls two subsequent methods that contain multiple parameters. I would like to run these methods simultaneously and then preform an action based on the return of both methods, so The parent thread cannot continue until BOTH threads have completed. I have tried going trough MSDN examples and haven't got anything to work (the issue is that the parent thread (aka the main method) continues on once one of the thread completes). I have tried cheking the state of threads and waiting the threads, but have not gotten anywhere. Any help would be great. Thanks.

Impersonation issue | Multiple domain

Hi,I am working on an Intranet site.The site is running with the following configurationWindows 2003 Server, IIS 6The users of the site come from 3 different domains (say Domain A, B, C). We have Integrated Windows Authentication turned on. App pool identity - Network Service Impersonation is turned Off in web.config. We try to impersonate the original caller programatically for one functionality where we try to access contents of a folder on shared drive by giving a UNC path. System.Security.Principal.WindowsImpersonationContext impersonationContext;impersonationContext = ((System.Security.Principal.WindowsIdentity)Context.User.Identity).Impersonate();...DirectoryInfo rootDir = new DirectoryInfo(path); DirectoryInfo[] dirContents = rootDir.GetDirectories();// We show the folders and files which can be downloaded after this ..impersonationContext.Undo();  The web server and the file share are on domain AIssue The above functionality works fine for all users coming from Domain A but for users coming in from Domain B and C get System.UnauthorizedAccessException at rootDir.GetDirectories(). But when the same users type the same UNC path from Win>Run or File Explorer, they are able to open it.The users are all coming in through IE6, so they do not have to provide their user name, password as trust has been established between all 3 domains. Can anyone please p

MOSS 2007 Alerts - Multiple Emails Issue

I've been experiencing a strange issue with SharePoint alerts that seem to happen randomly.  I've setup a daily alert on a custom list that sends a summary of all changes at 5pm, but on some days I'll receive more than 1 summary email (150+ this past Tuesday).  Each email contains different information and the total number of emails is random along with the number of records in each email.  Some days the summary comes in one email and others it comes in multiple.  This is happening on our production server and I haven't been able to recreate the issue in development.  Does anyone have any thoughts as to how a daily alert would get split up into several emails?We have 1 MOSS 2007 app server, 1 index server and 1 SQL 2005 database server.

Issue with Alerts with multiple Managed MetaData fields?

i'm seeing an issue in SharePoint 2010 with alerts.  If a list has more than 1 Managed MetaData columns, alerts stop working.  If I take it down to only one managed metadata column, they start working again.  Is this a known issue?  I'm seeing it in multiple sites/mulitple users.

WPF Threading issue with Win32 Container

We are trying to integrate existing WPF window on to Win32 container application. The win32 application can integrate and show only Winforms Usercontrols. Since we already have a running WPF window code, we used windows forms usercontrol , element host and the content presenter of the window inside the element host to show in winforms usercontrol.The WPF window code overrides the function protected virtual void OnInitialized(EventArgs e) and calls first base.OnInitialized and then the custom code. The issue is here is that you can run the below code for the first instance from win32 container , but second instance when we execute same code , it  throws the error "The calling thread cannot access this object because a different thread owns it." from the line  base.OnInitialized when initializing AutoUpdate window = new Autoupdate(); Even if we use the below code under dispatcher it throws the same error after the firstime.            ElementHost elementHost = new ElementHost();                         elementHost.Dock = DockStyle.None;                         element

Threading issue with TrackingParticipant


I have implemented a SynchronizationContext so my workflow are always call on the caller thread, even if not using the WorkflowInvoker. This way, I can be called in the Completed delegate and do some actions in the current Thread. But when I add a TrackingParticipant, the completed Handler isn't called on the caller thread like I expected...

Here is a sample to reproduce the sample with the threading culture (in my real scenario, I need something more important than culture...).

using System;
using System.Activities;
using System.Activities.Statements;
using System.Activities.Tracking;
using System.Diagnostics;
using System.Threading;

namespace ConsoleApplication5
  class Program
   static void Main (string[] args)
     const string ExpectedCultureName = "en-CA";

     Debug.Assert (System.Threading.Thread.CurrentThread.

LINQ to SQL Classes (dbml file) across multiple websites issue



I have a single LINQ to SQL Classes (dbml file) compiled in a Class Library that's referenced by 3 websites. Inside that Class Library there's also a class that's using the DBML to manipulate data.

At one point it needs to save in a user table the user info (firstname, lastname, email). SOMEHOW (!?) two of the 3 webapps saves email instead of firstname and viceversa while the other 1 saves them correctly ! The one compiled last seems to be the one saving correctly.

There's no code error as I have debugged this multiple times. The values are assigned correctly but before the SubmitChanges() call the data inside the database object is corrupted.

Now, I have already fixed this locally by putting every website in a separate AppPool (which also needs to be set to "Classic" and not "Integrated". However I really don't want to bug the client with such IIS changes so I'm looking for another workaround !

Please Help!



Upload Multiple Documents issue after office 2010 install



I am getting issue in "Upload Multiple Documents" after office 2010 install.

Its asking me to Drag n Drop files but after droping all files, if i click OK button , each file Staus is failed.

Kindly help me, its urgent.




One Gridview & Multiple CommandText Issue on Paging


Hi All,

I am using a gridview to display data from two separate functions. [VS 2010 on Framework 4]

This works fine without paging. On paging, clicking 'next page' invokes the older data(of function 1) instead of that in the new function (function 2) Cry


' Function 1

cmd.CommandText = "select * from table1,
Dim dTable As DataTable
Dim dataAdapter As SqlDataAdapter
            dTable = New DataTable
            dataAdapter = New SqlDataAdapter(cmd.CommandText, AquisitionString)

'Function 2

cmd.CommandText = "select * from table2,
Dim dTable As DataTable
Dim dataAdapter As SqlDataAdapter
            dTable = New DataTable
            dataAdapter = New SqlDataAdapter(cmd.CommandText, AquisitionString)

'Handling PageIndexChange

   Protected Sub grdAcquisition_PageIndexChanging(ByVal sender As Object, _
       ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdAcquisition.PageIndexChanging

Updating multiple Indexes on a table - Performance issue



I have a performance issue when trying to update a table with multiple indexes. The table itself has about 280 million rows. The selection of the records is fast, about 160 ms, as it has a suitable non-clustered index. However the update itself takes over 10 minutes.

When I look at the excution plan, it shows the update to the clustered index as well 5 other non clustered index which are being affected by the statement. Unfortunately it doesn't show me how those indexes are being accessed. I suspect that the update statement is performing a full index scan against each of the non-clustered indexes in order to do the update.

So my question is this, if i add the key columns of the other non-clustered indexes as included columns on the index used to select the records for update will sqlserver use them to access the additional non-clustered indexes?

any advice greatly appreciated


how to add multiple ajax ratings issue...


I am using visual studio 2008 C# 2.0. I have an issue adding multiple ratings...What i have of code so far is:


im adding this to datalist:

  <cc1:Rating ID="LikeRating" runat="server"
                    style="float: left;">
    </cc1:Rating><br />



 protected void r_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)

        Rating r = (Rating)sender;
        string id = r.ClientID;

        string s = e.Value;


and this is some of the xml file:


<entry... (some other attributes comes here)... ... ratingid="Guestbook_ctl00_r" ratingclicks="3" ratingresult="9">some text comes here..</entry>

so now the problem is how can i control ever

AutoPostBack issue with other web controls resulting in multiple clicks on "Save" Button


A new ASP.NET web application that I've been working on has among other web controls on the DetailView, a DropDownList for Category (ddlCategory) a TextBox for Quantity (txtQuantity) a Label for the Rate (lblRate) and a Label for the Amount (lblAmount) along with a Save button (btnSave), etc.; there are also TabIndexes set to progressively navigate from control-to-control ending on the Save button.  NOTE: the user would like to see the Rate & Amount values in the DetailView prior to saving the record.

The Rate is determined by the selected the Category so I have the AutoPostBack property set to "true" on ddlCategory to make a call to the database to retrieve the Rate on the SelectedIndexChanged event; likewise, the AutoPostBack property on txtQuantity is set to "true" in order to compute the Amount (and populate lblAmount) once the user enters a Quantity.  Theoretically, the user could enter the values sequentially and still go back to change the Category prior to the save so simply performing some client-side JavaScript to compute the Amount would not be bulletproof.

Everything works according to plan when the user tabs from control-to-control {e.g., Category > Quantity > Save}, or tabs off the control.  However, the problem occurs when the user enters all the values and then clicks on the Save button without tabbing off the

Multiple Drill Through Issue when using Report Viewer in SharePoint



I have a report that has a Pie chart and Bar Chart on it.  This report has default parameters on it.  Both the Pie Chart and Bar Chart Drill through to different reports. Looking at the paramater panel of this report all looks fine.

When I drill through on the Pie chart this works OK and the drill through reports this has another parameter on it.  The parameter panel updates correctly.  I then click the return to parent report and this returns correctly but does not update the parameter panel.

I then try to drill through on the Bar Chart (the report is showing the incorrect paramater panel) I get the following error.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C; .NET4.0E)
Timestamp: Mon, 26 Jul 2010 20:47:20 UTC

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'.
Line: 5
Char: 62099
Code: 0

.Net Remoting multi threading issue



I have a Windows service running on the server. It allows client workstations access it via .Net remoting. The Server service is simply a gateway to the database. Clients call methods on the Server class via remoting to make database calls (Selects, Inserts etc.).

During load testing we've observed the calls to the server take longer when multiple clients make simultaneous requests. The analysis indicates the requests are actually getting queued up. If 2 clients call the same method on the Server object, the two requests are processed in sequence. We have tried both Singleton and Singlecall. Same results.

Is there a bug in .Net remoting that it cannot process simultaneous client requests? If yes, is there a workaround (a quick one)?

We are using .Net 2.0 and are willing to switch to a higher version if the bug has been resolved in 3.0 or 4.0.



Issue with Report Model on a Cube (multiple measure groups)


Hi All, 

I have was asked to built a report model on the cube for some users and being new to report builder 3.0. 

I am having a weird issue. Lets Say I have following DIMS and FACTS. I have a cube built on top this Dimensional model. 

Two measure Groups/mearsures  : ClassFact/ClassHours and FacilitatorFact/FacilitatorHours.

used Many to Many relationship for FacilitatorDIM and ClassFact measuregoup. I now browse the cube it works excellent. 

The problem Starts

Now a report model is built on top of it, then in the query wizard when I pull both groups and then FName the Classhours(measure) Disappears. 

Does Report Modes supports Many to Many or am I missing something? Any help will be appreciated. 




ClassDIM (ClassID, ClassName) 

FacilitatorDIM ( FID, FName) 


ClassFact( ClassID, Classhours) 

FacilitatorFACT(FID, ClassID, FacilitatorHours)


Sample Data: 



SELECT     ClassID = 1 , ClassDurationHours = 100.0

FROM       ClassFact


SELECT     ClassID = 2 , ClassDurationHour

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Here is the code for binding the multiple drop down boxes in GridView using JQuery in ASP.NET
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend