What is an HttpHandler in ASP.NET

In the simplest terms, an ASP.NET HttpHandler is a class that implements the System.Web.IHttpHandler interface. ASP.NET HTTPHandlers are responsible for intercepting requests made to your ASP.NET web application server. They run as processes in response to a request made to the ASP.NET Site. The most common handler is an ASP.NET page handler that processes .aspx … Read more

Filehandler in asp.net

Create an ASHX (faster than aspx onload event) page, pass a the id of the file as a querystring to track each download public class FileDownload : IHttpHandler { public void ProcessRequest(HttpContext context) { //Track your id string id = context.Request.QueryString[“id”]; //save into the database string fileName = “YOUR-FILE.pdf”; context.Response.Clear(); context.Response.ContentType = “application/pdf”; context.Response.AddHeader(“Content-Disposition”, “attachment; … Read more

pass jquery json into asp.net httphandler

Try data: JSON.stringify([{id: “10000”, name: “bill”},{id: “10005”, name: “paul”}]) edit I removed the quotes from the property names Also, the JSON string needs to be read in other way string jsonString = String.Empty; HttpContext.Current.Request.InputStream.Position = 0; using (StreamReader inputStream = new StreamReader(HttpContext.Current.Request.InputStream)) { jsonString = inputStream.ReadToEnd(); } An working solution public void ProcessRequest(HttpContext context) { … Read more

IRequiresSessionState vs IReadOnlySessionState

One critical difference is that IRequiresSessionState puts an exclusive lock on the current session, thereby potentially limiting the # of concurrent requests from the current user. (For more background on this locking phenomenon, see Is it possible to force request concurrency when using ASP.NET sessions?) In contrast, IReadOnlySessionState does not acquire an exclusive lock. This … Read more