I’ll look into those. Alternately, would it be easier to just do something like:

    Thread dbTask = new Thread(new SomeThreadStart(SomeParameters));
    dbTask.IsBackground = true;
dbTask.Start();

Response.Redirect(“somewhere”)

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: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of andrew.d...@gmail.com
Sent: Thursday, 30 July 2015 8:30 PM
To: ozDotNet <ozdotnet@ozdotnet.com>
Subject: Re: MVC Redirect and Async Operations

async HTTP handler ?

On 30 July 2015 at 20:06, Greg Low (罗格雷格博士) 
<g...@greglow.com<mailto:g...@greglow.com>> 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<tel:%281300%20775%20775>) 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