asp.net mvc 3 - MVC3 Passing ControllerContext to thread? -


i using rotativa in mvc3 app generate pdfs memory stream emailed out email attachment. works fine quite slow (~5-7 seconds 1 user) i've been trying put separate thread user doesn't stuck huge delay.

the problem i've been facing rotativa requires controller context generate data memory stream, means if try put in separate thread , return notification user context disposed , pdf generation fail.

unfortunately email validation check on server-side , return true/false appropriate, false prompt user fix , try again. means can't assume email valid (i jquery, if turn off , try submit won't error message).

so far have tried:

  • creating new thread , passing context in
  • duplicating context copying new variable
  • serializing context, passing stream new thread , de-serializing (unfortunately context not serializable)

has got other ideas?

here run long process in background context. i'm using custom sessions backed database. you'll need pass whatever values need "background" action.

using (var client = new webclient()) {      var values = new namevaluecollection      {          { "sessionid", datasession.id.extractsid() }      };      client.uploadvaluesasync(new uri(url.absoluteaction("resultscallback", "quote")), values); }                 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -