I'm working in an application in asp.net/C#, in which I have integrated a third party product (using their supported API).
Now in application's particular Button_Click()
event, I want to do three tasks.
- First one is simplest, inserting data to sql server and sending the same date to that third party server, its DONE.
- Second and complicated one is which I elaborated below.
- Getting the
status(data)
fromtask2
and doing operation in database.
Here's that, I need to check that third party server for a particular switch. Switch means whether the data is present or not. I'm using a bool getData()
method of that API
to retrieve the status, it will return ACTIVE
/INACTIVE
.
But the problem is that getdata()
method will take few minutes to verify that switch, like ~2-7 Mins
till that the application will not be idle, the user will do anything which is provided in the application.
What I have did is this:
Done the Task1
, and made the task2
in separate thread, it works fine for some time so that the third task also does it job.
But threads are not working as expected, if the user does any other operation like reloading the page or anything else, thread gets interrupted and stopped. So both the task2
and task3
fails.
Any other solution for this?