The handler or web hook described here processes callbacks from the GrabzIt screenshot web service. The URL of this handler is passed to GrabzIt in the callBackURL
parameter of the SaveAsync method.
However this technique will only work if the handler is accessible via the Internet.
The following parameters are passed to the handler as GET parameters.
If you want to block all access to the handler, except from GrabzIt then use this security technique.
To add a handler to a MVC project simply define a method with the following signature in a controller. Then pass the URL of this method to GrabzIt so if this is in the Home controller then the callback URL could look something like: http://www.example.com/Home/Handler
public async TaskHandler(string filename, string id, string message, string customId, string format, int targeterror) { //The client should be stored somewhere and reused! GrabzItClient grabzItClient = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret", client); GrabzItFile file = await grabzItClient.GetResultAsync(id); file.Save(Server.MapPath("~/results/" + filename)); return null; }
While the above technique uses a generic handler, you can just as easily use a ASPX pagem or any other type of page. To recieve the callback and download the capture. To do this just create your own ASPX page etc and then read the querystring parameters mentioned above. The most useful parameter is the id parameter, which can be used with the GetResult
method to download the capture.