Used:

ThreadPool.QueueUserWorkItem(delegate{ methodcallhere(); });

And wrapped it in an “I don’t care” error handler.

Regards,

Greg

Dr Greg Low

1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913 fax
SQL Down Under | Web: www.sqldownunder.com<http://www.sqldownunder.com/>

From: [email protected] [mailto:[email protected]] On 
Behalf Of Tom Rutter
Sent: Monday, 3 August 2015 9:30 AM
To: ozDotNet <[email protected]>
Subject: Re: MVC Redirect and Async Operations

How did you end up doing it Greg?

On Sat, Aug 1, 2015 at 9:51 PM, Greg Low (罗格雷格博士) 
<[email protected]<mailto:[email protected]>> wrote:
And implemented and working like a charm. Thanks all.

Regards,

Greg

Dr Greg Low

1300SQLSQL (1300 775 775) office | +61 419201410<tel:%2B61%20419201410> mobile│ 
+61 3 8676 4913<tel:%2B61%203%208676%204913> fax
SQL Down Under | Web: www.sqldownunder.com<http://www.sqldownunder.com/>

From: Greg Low (罗格雷格博士)
Sent: Saturday, 1 August 2015 6:26 PM
To: ozDotNet <[email protected]<mailto:[email protected]>>
Subject: RE: MVC Redirect and Async Operations

Thanks guys. Makes sense.

Regards,

Greg

Dr Greg Low

1300SQLSQL (1300 775 775) office | +61 419201410<tel:%2B61%20419201410> mobile│ 
+61 3 8676 4913<tel:%2B61%203%208676%204913> fax
SQL Down Under | Web: www.sqldownunder.com<http://www.sqldownunder.com/>

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Corneliu I. Tusnea
Sent: Saturday, 1 August 2015 6:13 PM
To: ozDotNet <[email protected]<mailto:[email protected]>>
Subject: Re: MVC Redirect and Async Operations

Task(()=> { ... do stuff }).Start()


On Thu, Jul 30, 2015 at 8:06 PM, Greg Low (罗格雷格博士) 
<[email protected]<mailto:[email protected]>> wrote:
One for the MVC brains trust if I can:

I want to add some basic link redirection and logging to a test MVC site. So, 
for example, if I have a calls like:

http://www.mytestsite.com/links/10123
http://www.mytestsite.com/links/10939

I want to redirect the caller to some other URL associated with each link 
number. All easy enough.

However, I also want to log details to my database about that call/redirection 
and that’s where the issue arises.


•         I don’t want the redirection to wait synchronously for the DB call to 
complete.

•         If the logging didn’t work, I still want the redirection to occur.

I’m presuming that as soon as I return a Response.Redirect or 
Response.RedirectToAction, etc, etc. that I can’t then execute code afterwards 
in the same call. I’ve wondered about starting an async DB operation and just 
not waiting for it to complete.

Any suggestions on how best to achieve that outcome? Is some sort of 
ActionFilter a better option?

Thanks in advance,

Regards,

Greg

Dr Greg Low

1300SQLSQL (1300 775 775) office | +61 419201410<tel:%2B61%20419201410> mobile│ 
+61 3 8676 4913<tel:%2B61%203%208676%204913> fax
SQL Down Under | Web: www.sqldownunder.com<http://www.sqldownunder.com>



Reply via email to