zencoder-cs icon indicating copy to clipboard operation
zencoder-cs copied to clipboard

Extend or overload INotificationReceiver for passing HttpContext

Open snap608 opened this issue 13 years ago • 1 comments

A suggestion is to extend INotificationReciever to include the HttpContext to the OnRecieve method.

The reason to this is to be able to access context.Server.MapPath() to store data received from Zencoder.

Example: public void OnReceive(HttpPostNotification notification, HttpContext context)

PS: I have already done this for my application and maybe try to create a fork and sending you a pull request. :)

snap608 avatar Jan 27 '12 12:01 snap608

Just ran into this problem myself, accessing HttpContext.Current (even if you modify the INotificationReceiver to contain it) is not threadsafe I think, since if the original processing thread goes away, the HttpContext calls will fail. I have changed my notification method to use System.Web.Hosting.HostingEnvironment.MapPath() rather than HttpContext.Current.Server.MapPath The only other thing you might need from HttpContext.Current is Session but similar problems exist here with cross threading.

agrath avatar Jun 10 '13 04:06 agrath