GrabzIt चे ASP.NET API इव्हेंटचे देखील समर्थन करते, खाली हँडलर नियुक्त करण्याचे एक उदाहरण आहे ScreenShotComplete
स्क्रीनशॉट कॉल होण्यापूर्वी कार्यक्रम. नंतर एकदा स्क्रीनशॉट मध्ये कोड पूर्ण झाला grabzIt_ScreenShotComplete
पद्धत म्हणतात.
private GrabzItClient grabzIt = GrabzItClient.Create("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); protected void btnSubmit_Click(object sender, EventArgs e) { grabzIt.ScreenShotComplete += grabzIt_ScreenShotComplete; grabzIt.URLToImage("https://www.tesla.com"); //The below line specifies the GrabzIt.ashx handler inside the GrabzIt.dll grabzIt.Save(HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath + "GrabzIt.ashx"); } //The event method saves the screenshot protected void grabzIt_ScreenShotComplete(object sender, ScreenShotEventArgs result) { GrabzItFile file = grabzIt.GetResult(result.ID); file.Save(Server.MapPath("~/results/"+result.Filename)); }
शेवटी वेब कॉन्फिग कॉन्फिगर करा जेणेकरुन ग्रॅबझिट.एक्सएक्स पोintएस हँडलर मध्ये एम्बेड केलेले GrabzIt DLL. जर हे योग्यरित्या केले गेले नाही तर ScreenShotComplete
कार्यक्रम काढून टाकला जाणार नाही.
हे लक्षात ठेव कॉलबॅक आपला अनुप्रयोग लोकलहोस्ट वर असल्यास कार्य करणार नाही.
<httpHandlers> <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" /> </httpHandlers>