ihttphandler

What is the use for IHttpHandler.IsReusable?

北战南征 提交于 2019-11-28 04:48:04
I'm writing a IHttpHandler and I'll need to implement a IsReusable property. When I look at the MSDN documentation it says: Gets a value indicating whether another request can use the IHttpHandler instance. This isn't very helpful. In which situations should I use a reusable handler and in which situations should it not be reusable? Follow up questions: What is reuse? Can I maintain state (i.e. class variables) when Reusable = true ?? This property indicates if multiple requests can be processed with the same IHttpHandler instance. By default at the end of a request pipeline all http handlers

Async Await Handler Deadlock

房东的猫 提交于 2019-11-27 22:28:40
I'm stuck in an Async deadlock and I can't figure out the correct syntax to fix it. I've looked at several different solutions, but can't seem to quite figure out what is causing the problem. I am using Parse as a backend and trying to use a handler to write to the table. My handler looks something like: public class VisitorSignupHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { //Get the user's name and email address var UserFullName = context.Request.QueryString["name"].UrlDecode(); var UserEmailAddress = context.Request.QueryString["email"].UrlDecode(); //Save the

Why isn't my IHttpHandler being called?

两盒软妹~` 提交于 2019-11-27 21:32:41
问题 I'm trying to get a custom handler to work for a specific URL (or set of URLs) in ASP.NET 3.5. The handler doesn't actually do anything significant yet - it just logs the request. I can post the code if anyone things it's relevant, but I really don't think it's being called at all. (In particular, for normal exceptions I get a custom error page and logging... here I'm just getting the vanilla IIS 404.) Here's the relevant bit of the web.config file: <system.web> <httpHandlers> <add verb="GET

Uploadify ashx file Context.Session gets null

会有一股神秘感。 提交于 2019-11-27 12:53:30
问题 I have a file upload in my site which is done using uploadify it uses a ashx page to upload file to database.It works fine in IE but in Mozilla the context.Session is getting null.I have also used IReadOnlySessionState to read session. how can i get session in Mozilla like IE. here is the ashx code i have done public class Upload : IHttpHandler, IReadOnlySessionState { HttpContext context; public void ProcessRequest(HttpContext context) { string UserID = context.Request["UserID"]; context

How to send a Status Code 500 in ASP.Net and still write to the response?

微笑、不失礼 提交于 2019-11-27 11:31:58
I have an ASP.Net single-file web service (a .ashx file containing an IHttpHandler implementation) which needs to be able to return errors as responses with 500 Internal Server Error status codes. This is a relatively straightforward thing to do in PHP: header("HTTP/1.1 500 Internal Server Error"); header("Content-Type: text/plain"); echo "Unable to connect to database on $dbHost"; The ASP.Net (C#) equivalent should be: Context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; Context.Response.ContentType = "text/plain"; Context.Response.Write("Unable to connect to database on " +

What is an HttpHandler in ASP.NET

☆樱花仙子☆ 提交于 2019-11-27 10:27:27
What is an HttpHandler in ASP.NET? Why and how is it used? 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 files. When users request an .aspx file, the request is processed by the page through the page handler. ASP.NET offers a few default HTTP handlers : Page Handler (.aspx):

Filehandler in asp.net

谁说胖子不能爱 提交于 2019-11-27 09:38:40
I need to track when a pdf is opened in my web app. Right now I am writing to a database when a user clicks on the link and then using window.open from the code behind which isn't ideal since Safari blocks popups and other web browsers give a warning when it runs so I was thinking would a Filehandler be what I need to use. I haven't used a Filehandler in the past so is this something that would work? The pdf is not in binary form, it's just a static file sitting in a directory. Create an ASHX (faster than aspx onload event) page, pass a the id of the file as a querystring to track each

ASP.NET: How to access Session from handler? [duplicate]

主宰稳场 提交于 2019-11-27 03:55:24
This question already has an answer here: How to use ASP.NET Session State in an HttpHandler? 4 answers i'm trying to store some values in the Session from a Handler page , before i do a redirect to a WebForms page, that will pick up the Session values and pre-fill the WebForm: public class Handler : IHttpHandler { public void ProcessRequest(HttpContext context) { ... context.Session["StackOverflow"] = "overflowing"; context.Response.Redirect("~/AnotherPage.aspx"); ... } ... } Except context.Session object is null. How do i access Session state from a handler? JoshBerke Implement the System

Can ASP.NET Routing be used to create “clean” URLs for .ashx (IHttpHander) handlers?

余生长醉 提交于 2019-11-27 03:45:33
I have some REST services using plain old IHttpHandler s. I'd like to generate cleaner URLs, so that I don't have the .ashx in the path. Is there a way to use ASP.NET routing to create routes that map to ashx handlers? I've seen these types of routes previously: // Route to an aspx page RouteTable.Routes.MapPageRoute("route-name", "some/path/{arg}", "~/Pages/SomePage.aspx"); // Route for a WCF service RouteTable.Routes.Add(new ServiceRoute("Services/SomeService", new WebServiceHostFactory(), typeof(SomeService))); Trying to use RouteTable.Routes.MapPageRoute() generates an error (that the

Update page after file download

♀尐吖头ヾ 提交于 2019-11-27 02:52:22
问题 I put together a download script after some wonderful help from stack overflow the other day. However I have now found that after the file has been downloaded I need to reload the page to get rid of the progress template on the aspx page. The code to remove the template worked before I added in the download code. Code to remove progress template: upFinanceMasterScreen.Update(); I've tried calling putting this before and after the redirect to the IHttpHandler Response.Redirect("Download.ashx