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

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

Background Thread + Impersonation + Termination

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net

I have an ASP.NET 2.0 web application that is running in Windows Impersonation Mode...

Where the web site is configured as:

- Disable anonymous access

- and web.config

<authentication mode="Windows"/>
<identity impersonate="true"/>
      <allow users="DOMX\USER1"/>
      <allow users="DOMX\USER2"/>
      <allow users="DOMX\USER3"/>
      <allow users="DOMX\USER4"/>
      <deny users="?"/>
      <deny users="*"/>

This application needs to execute a potentially time consuming set of actions.  I had a couple of questions about using a background thread...

Question 1:   If I launch a background thread in the code behind... will that thread be terminated when the web application timesout?

Question 2:  If I decide to utilize a separate process (i.e. using System.Diagnostics.

View Complete Post

More Related Resource Links

WPF: How to interact between UI thread and background thread?

our application needs us to do some heavy work on background thread. however, sometimes the background thread work needs user input to make some decision during the middle process. so we need to back the UI thread to get user input and then back the background thread to continue finish the heavy work. Is there example to show us how to interact bewtween UI thread and background thread? thanks, Jane  

Raising PropertyChanged on a background thread.

What's the official word from Microsoft on raising the PropertyChanged event on a background thread for a property that's bound to a WPF gui? A couple blogs/sites say that the event is automatically dispatched to the UI thread. I am able to verify this in my own my own tests. I can bind to a property on a view model and then set the property on a background thread without issues. I am able to verify that the property setter is called on a background thread; yet, the UI updates without issues. An example property:   private Brush _background; public Brush Background { get { if (this ._background == null ) { this ._background = Brushes.Blue; } return this ._background; } set { if (this ._background != null ) { Debug.WriteLine(Application.Current.Dispatcher.CheckAccess() ? "On UI Thread" : "On Background Thread" ); this ._background = value; this .OnPropertyChanged("Background" ); } } } If I set this property on a background thread, all backgrounds on controls bound to this property will change without problems. Any official word on this behavior?  

How to pause resume Background Worker Thread?


We are working on a VB.Net window based application and we are using Visual Studio 2010 Professional.

In our application during the execution process we have used Background Worker thread and user have the option of cancelling the execution only.

Now we came across a situation that if user wants to pause the execution process then how we can pause the background worker thread so that it can be resumed on resuming the execution by the user?



Premjeet Singh

Regards, Premjeet Singh

Handling API events in a background thread



I am in the planning stages for developing a VB.Net class (I am using VS 2008) that is to obtain data via an API provided by a COM object (AxInterop.TWSLib) making requests to an Internet server. The API provides data via events. The class should do its work on a separate thread; it takes several seconds (sometimes up to ~10) to collect the desired data. One should be able to instantiate several instances of the class in order to collect data in parallel. The class would be given a reference to the TWSLib object when its constructor is called, as well as several parameters. There needs to be a way for the class to provide results, preferably in the form of a generic list.

I have succeeded creating multithreads using the backgroundworker approach. From what I have read, though, that does not appear to be the appropriate approach when the background thread is supposed to wait for events to handle. I have not tackled more advanced multithreading approaches. Studying VS 2008 documentation on Threading, ThreadPool, delegates, etc. has not yet given me an idea how to design a class that handles those API event

While processing large cubes, various file system errors: "the background thread running lazy writer



We consistently get these I/O errors when processing large OLAP databases.  After a reboot, I can usually get a database to process a few times, but then suddenly reprocessing will fail with errors similar to the one shown below, when nothing changed (no data or structure changes).  The specific file(s) it reports are always different.  Also, sometimes it crashes the msmdsrv.exe process, which seems to intermittently affect other server functions as well (killing the ability to RDP into the server, or the ability to open Event Viewer).


<error message>

File system error: The background thread running lazy writer encountered an I/O error.
Physical file: \\?\D:\OLAPData\SSAS1\SA1.166.db\SA1 Data Source View 1.238.cub\Fact Subject.231.det\Fact Subject.221.prt\271.Aspect.Source Key.fact.map.hdr.
Logical file: .
File system error: The following error occurred while writing to the file 'LazyWriter Stream':
Insufficient system resources exist to complete the requested service. .
File system error: The background thread running lazy writer encountered an I/O error.
Physical file: \\?\D:\OLAPData\SSAS1\SA1.166.db\SA1 Data

Alternating row background for first column of a report


is there a way to make the first column of a report use the an alternating background color? 

I have the background color set for the entire row however it does not work for the first column if the color is set to an expression.  If I just set it to a color i.e. red it works just fine. If I insert a dummy column to the left it works just fine (but the dummy column does not work, presumably because it is first??).

In the file below only the textbox for part number does not show an alternating background.  All others work correctly.

                    <Textbox Name="PartNumber">

Selected to change the background color of the page



As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.

Wrong Account being used to access files - Help - No Impersonation


I run a simple .aspx website on a Windows Server 2008 machine.

There is NO impersonation, and System.Security.Principal.WindowsIdentity.GetCurrent().Name returns NT AUTHORITY\NETWORK SERVICE, which it the account which the application pool runs. In my web.config, I have <authentication mode="Forms">.


I tried to test the security of the application and server by removing file permissions to the .aspx files. I was greatly worried when the website continued to run without problem (it should not have been able to read the .aspx files).

By turning on file level auditing, I discovered that the .aspx files were being read by the machine$ account (if the machine is called Serv1, then the files would be read by the Serv1$ account, which seems to have access to all files on the local machine).


Is this a security breach or is this behaviour by design ?

Please can somebody assist, as I am worried.

how to make a css style background image be linked to an image in the resource file


hey guy, i need help in a very troubling matter. I want to make a textbox with a specific style, within this style a set of images as background parts, how can i attach these images to the custom control as whenever i take the .dll file and add it to the toolbar the images do not appear. So i tried to make them as resource files and their property as embedded in .resx file, so how to make the css style background image url to be linked to any of those image.

thanks in advance

Thread Performance: Resource Contention Concurrency Profiling in Visual Studio 2010


Visual Studio 2010 includes new resource contention profiling features that help detect concurrency contention among threads. We walk through a profiling investigation to demonstrate how you can pinpoint and fix resource contention problems in your code.

Maxim Goldin

MSDN Magazine June 2010

Thread Diagnostics: Performance Tuning with The Concurrency Visualizer in Visual Studio 2010


Understanding performance bottlenecks in multithreaded apps used to require significant instrumentation and analysis by expert developers. The Concurrency Visualizer in Visual Studio 2010 significantly reduces the burden of parallel performance analysis.

Hazim Shafi

MSDN Magazine March 2010

CLR Inside Out: Thread Management In The CLR


Getting the performance you want in concurrent applications is not as straightforward as you might think. See how common threading issues can affect your application.

Erika Fuentes and Eric Eilebrecht

MSDN Magazine December 2008

Editor's Note: new Thread(ReadEditorsNote).Start(); yourAttention.WaitOne();


Introducing the issue, Howard Dierking points out that you can't simply parallelize your code blindly if you expect to truly reap the benefits that parallelism promises.

Howard Dierking

MSDN Magazine October 2008

Pooled Threads: Improve Scalability With New Thread Pool APIs


The new threadpool APIs in Windows Vista and in the upcoming Windows Server 2008 provide advances that even native Windows developers can benefit from.

Robert Saccone

MSDN Magazine October 2007

Concurrent Affairs: Build a Richer Thread Synchronization Lock


In my last column, I showed the various thread synchronization mechanisms employed by the Microsoft® . NET Framework (see Concurrent Affairs: Performance-Conscious Thread Synchronization). I then examined the performance characteristics of all these mechanisms and determined that the Interlocked methods performed the best because the calling thread never has to transition to kernel mode.

Jeffrey Richter

MSDN Magazine March 2006

Concurrent Affairs: Performance-Conscious Thread Synchronization


In my career, I have architected and implemented many thread synchronization techniques. This has provided me with a lot of experience that has shaped the way I now think about thread synchronization problems.

Jeffrey Richter

MSDN Magazine October 2005

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