Tools to Capture and Convert the Web

Screenshot Events with ASP.NET

ASP.NET API

GrabzIt's ASP.NET API also supports events, below is an example of assigning an handler to the ScreenShotComplete event before the screenshot is called. Then once the screenshot is completed the code within the grabzIt_ScreenShotComplete method is called.

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));
}

Finally configure the web.config so that GrabzIt.ashx points to the handler embedded in the GrabzIt DLL. If this isn't done properly the ScreenShotComplete event won't be fired.

Remember this callback will not work if your application is located on localhost.

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