I would go with ThreadPool.QueueUserWorkItem before returning redirect
response

On 30 July 2015 at 20:06, Greg Low (罗格雷格博士) <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) office | +61 419201410 mobile│ +61 3 8676 4913
> fax
>
> SQL Down Under | Web: *www.sqldownunder.com <http://www.sqldownunder.com>*
>
>
>

Reply via email to