Signaling Web Page When ThreadPool Thread Is Completed?

Aug 25, 2010

From a web page I start a time consuming job and update it's status on the UI using webmethod.

Job is done in a thread:

ThreadPool.QueueUserWorkItem(new WaitCallback(DoJob), parameters); Job set's it status using static properties, and when web page, using javascript, calls web method it read those properties.

[System.Web.Services.WebMethod]
public static ProcessStatus GetProgressStatus()
{
Jober.Lock.EnterReadLock();
ProcessStatus st = new ProcessStatus(Jober.PercentageCompleted, Jober.TotalNumber);
Jober.Lock.ExitReadLock();
return st;
}

The UI progress is updated through javascript, the problem is that after thread completes I need to update UI on server side, so javascript won't help me here. What Is the best way to signal when thread is completed?

View 1 Replies


Similar Messages:

Thread ID From ThreadPool.QueueUserWorkItem?

May 18, 2010

after invoking an async method using ThreadPool.QueueUserWorkItem how do i lookup the assigned thread id?

View 4 Replies

ThreadPool Thread Running As User =ASPNET

Nov 24, 2010

I have a web service that uses ThreadPool to delegate a task to a thread but it runs on ASPNET (System.Environment.UserName) while the main thread runs as windows account. How can I make this thread run with same windows account. Note that I have impersonate=true in web.config. This is causing problems accessing database.

View 1 Replies

Web Forms :: Wizard Control Steps Completed / Not Completed?

Apr 20, 2010

I'm looking for some opinions on how to go about the following:

Say I have a wizard control in my website, and I've completed all the steps on the wizard and I want to redirect to another page after the "Finish" button I've clicked. So, then after that I logout of my site, and go back into it bearing in mind the wizard has been completed, I want to redirect the user to another page and by-pass this wizard control. Would I setup a flag in the database, to indicate if the wizard control has been completely filled or not. If status = true then redirect the user to different page (and bypass wizard)... but if status = null then make sure user still can go through steps in the wizard control.

[Code]....

set a flag to state whether all of the wizard has been filled in or not / otherwise go back and complete the wizard?

View 2 Replies

Cross-thread Operation Not Valid: Accessed From A Thread Other Than The Thread It Was Created On

Apr 2, 2010

I want to remove checked items from checklistbox (winform control) in class file method which i am calling asynchronously using deletegate. but it showing me this error message:-

Cross-thread operation not valid: Control 'checkedListBox1' accessed from a thread other than the thread it was created on.

i have tried invoke required but again got the same error. Sample code is below:

[code]....

View 1 Replies

MVC: Signaling To JQuery That An AJAX Request Has Failed

Nov 18, 2010

Controller: Products and Action: Save, return a JsonResult. If a trapped exception occurs, i would like to signal that error to the client (ie:jQuery) with a custom error message. How can I do that both on the server and client? Can i utilize the function pointer error in this scenario?

Here's the client code

[code]....

View 1 Replies

JQuery :: How To Know All Elements In Web Page Are Completed Loaded

Mar 9, 2011

I wanna show a waiting screen when all elements in my web page are loading, and waiting screen will show off when loading is complete. I don't know how to get notification in Jquery when all elemnts are completely loaded ?

View 1 Replies

How To Disable The Whole Page Until The Loading Process Gets Completed

May 28, 2010

i have one web page in aps.net and i want that page to be disable untill the whole page loading process gets completed.

View 3 Replies

Security :: Redirect To Login Page After Completed 10seconds?

Jan 18, 2011

How can i set redirection in given time.

After session expired i want to show warning page and then it should redirect to login page. In my warning page user can wait 10 seconds without clicking login attempt .

View 2 Replies

AJAX :: Update Page Portion After Some Processing Completed At Server?

Feb 23, 2010

I have devloped a dashboard, which contains different sections. Each section shows a certain user control. some user controls shows graphs and grids and some information after some calculations. Some of these controls take times (10 seconds) to load, that's why whole page take a remarkable time to load.

I wana display skelton of page and some of controls, not taking much time, and display some processing sign on controls taking time more than 5 seconds. and refresh contents of these controls after processing at server done.

View 2 Replies

Web Forms :: Display Loading Image Until Page Load Is Completed

Mar 28, 2012

 i want  until webpage is not  complete on my page show some download picture like some picture that show when we download something .

View 1 Replies

Visual Studio :: Debug A Multi Thread Program To See Local Variables Of Each Thread Using 2008

Jan 27, 2010

How can we debbug a multi-thread program to see local variables of each thread using visual studio 2008.

View 1 Replies

Architecture :: How Can Thread Update A Variable Shared With The Main Thread

Nov 24, 2010

I'm new to threading and have used it successfully, but limited. I can spawn a thread and have the main thread reference variables in the spawned thread, but I don't know how to allow the spawned thread to reference (and update) variables in the main thread.

Any example threading code I've seen on the web appears to be WAY more complicated than what I do, so I am unable to understand or integrate into my code.

Here is a quick example of how I use threading:

[code].....

View 3 Replies

AJAX :: AsyncFileUpload And GridView - Getting The Partial Page Postback To Fire After The File Upload Has Completed

May 28, 2010

I have two controls, each placed in their own <div> and <UpdatePanel> on my form. I am having trouble getting the partial page postback to fire after the file upload has completed. I have not used the __doPostBack approach before so I'm not sure if I am heading in the right direction.

View 6 Replies

What Are The Differences Between Currently Executing .NET Thread And Win32 Thread

Mar 24, 2010

I am reading the Asp.net security documentation on msdn.I come across these tow terms and get really confused.

# WindowsIdentity = WindowsIdentity.GetCurrent()

which returns the identity of the security context of the currently executing Win32 thread.

# Thread = Thread.CurrentPrincipal

which returns the principal of the currently executing .NET thread which rides on top of the Win32 thread.

View 1 Replies

C# - Lock Thread.sleep Not Working With .NET Thread?

Jun 25, 2010

I have a password page and when someone enters an incorrect password I want to simply foil a brute force attack by having

bool isGoodPassword = (password == expected_password);

lock (this)
{
if (!isGoodPassword)
Thread.Sleep(2000);
}
I would expect that this would allow all correct passwords without stalling, but if one user enters a bad password another successful password from a different user would also be blocked. However, the lock doesn't seem to lock across ASP.NET threads.

View 4 Replies

Web Forms :: Use Thread.sleep Method For A Particular Thread?

Aug 27, 2010

I want a example of multithreading .i want to use it in a web form not on console.i am using C#.net .and how to use thread.sleep method for a particular thread.

View 5 Replies

Caching - .NET CacheDependency Out Of ThreadPool

Feb 19, 2010

In an async http handler, we add items to the ASP.NET cache, with dependencies on some files. If the async method executes on a thread from the ThreadPool, all is fine:

AsyncResult result = new AsyncResult(context, cb, extraData);
ThreadPool.QueueUserWorkItem(new WaitCallBack(DoProcessRequest), result);

But as soon as we try to execute on a thread out of the ThreadPool:

AsyncResult result = new AsyncResult(context, cb, extraData);
Runner runner = new Runner(result);
Thread thread = new Thread(new ThreadStart(runner.Run());

... where Runner.Run just invokes DoProcessRequest,

The dependencies do trigger right after the thread exits. I.e. the items are immediately removed from the cache, the reason being the dependencies.We want to use an out-of-pool thread because the processing might take a long time.

So obviously something's missing when we create the thread. We might need to propagate the call context, the http context...

Note: off-the-shelf custom threadpools probably solve this. Writing our own threadpool is probably a bad idea (think NIH syndrom). Yet I'd like to understand this in details, though.

View 1 Replies

C# - ThreadPool.QueueUserWorkItem Causes App To Hang Until Finished?

Dec 10, 2010

This may be due to a lack of understanding of what's going on under the hood or simply a lack of understanding of threading in general. When a user logins I need to run some tasks that call web services to update data in my system. Since the services could take a considerable amount of time I thread the entire process. However, even though I think I'm running the whole series of tasks in a thread separate from my application, my application waits until the called function is finished before it proceeds.

WindowsIdentity identity = WindowsIdentity.GetCurrent();
Manager manager = (Manager)Session["Manager"];

ThreadPool.QueueUserWorkItem(new SafeWaitCallback().Call(identity, delegate(object noCallBack)
{
manager.RunAccountUpdater(identity);
}));

The application hangs until the function "RunAccountUpdater" is finished and the callback occurs. What am I doing wrong/not understanding?

View 1 Replies

Using Threadpool.QueueWorkItem In Asnychronous Handler

Mar 28, 2011

This MSDN example for an Asynchronous Handler starts the new thread using ThreadPool.QueueUserWorkItem.

I thought that you should not use ThreadPool.QueueUserWorkItem to start the new thread as the thread is taken from the ASP.net thread pool and defeats the purpose of using an Asynchronous handler.

Is the example wrong?

View 1 Replies

Multithreading - .net ThreadPool - Long Running Operation.

Jan 27, 2010

My application is a asp.net 3.5 running on iis 6 (windows 2003)

This application is serving 1000's of users daily (100-500 users online).

I want to send an email newsletter to customers weekly.

Around 200,000 emails every time.

This is the code im using:

ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncProcessMailerQueue), null);

private static void AsyncProcessMailerQueue(object data)[code]....

When testing this locally (on my dev machine) i see the application is working alot slower.

Is there a better way to write this code? Should i use ThreadPool.QueueUserWorkItem or create a new thread using Thread t = new Thread(new ThreadStart(DoWork)); ? Will it be better to create a totally seperate application for the purpose of sending the newsletters. will that help if ill run this application on the same machine?

i've seen other posts here talking about ThreadPool vs Thread but its seem no one is sure which is better.

View 3 Replies

Trying To Refresh A Page Through A Thread?

Apr 3, 2010

So basically here I am trying to wait for my server to connect to my website signaling it that its done and so the page needs to be refreshed(cause sql was updated). Thing is when I try to use the response/request in the thread it simply doesn't want to work.

Here the code

Code:

[code]....

Errors I am getting are:

1. If I have the headers clear thing there it gives requires integrated IIS pipes or something like that.
2.If I don't have the clear headers it says the headers were already sent.

View 13 Replies

Net - Update A Page From A Worker Thread?

Jul 30, 2010

I have a ASPX page which queries from a database. Once we have the dataset it is bound to a gridview and displayed on the page. All this happens in the Page_Load event.Ofcourse this a simplistic approach. What is the best way to inform the user that data is being retrieved and when we have the data to update the page with the results in the dataset.I want all this to happen within the same ASPX page and do not want to hop around pages to achieve this. I looked at update panels however it wasn't clear to me how this could be done with an update panel without having a control which triggers the update for the update panel. There are no controls on my page whhich initiate the database query, it occurs as the page is loaded

View 1 Replies

Web Forms :: Implementing The Threadpool Concept And Have Doutbt In Threads Being Created

May 14, 2010

Am implementing the threadpool concept and have doutbt in threads being created.

[Code]....

Initially i gave (1,1) in semaphores and only one thread was created and it did only one task, and (5,5) created one thread and it used for all the times.

Is ter anything wrong in wat i did or any other way of doin other than semaphores. And mainly wat abt the remaining 20 threads in threadpool? its a waste of CPU right. Can i create only 5?

View 6 Replies

Thread Was Being Aborted In WebService And ASPX Page?

Jan 20, 2011

I'm having the Thread was being aborted exception in this simple code, running on IIS 6 when i run a long query.

[Code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved