वेब पर कब्जा और परिवर्तित करने के लिए उपकरण

ASP.NET के साथ स्क्रीनशॉट इवेंट

ASP.NET API

GrabzIt के ASP.NET एपीआई घटनाओं का भी समर्थन करता है, नीचे एक हैंडलर को असाइन करने का एक उदाहरण है 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));
}

अंत में web.config कॉन्फ़िगर करें ताकि GrabzIt.ashx pointके लिए है हैंडलर में एम्बेडेड है GrabzIt DLL। यदि यह ठीक से नहीं किया गया है ScreenShotComplete घटना को निकाल नहीं दिया जाएगा।

यह याद रखना वापस कॉल करें यदि आपका एप्लिकेशन लोकलहोस्ट पर स्थित है तो काम नहीं करेगा।

<httpHandlers>
        <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" />
</httpHandlers>