ihttphandler

IIS 7, HttpHandler and HTTP Error 500.21

我的未来我决定 提交于 2019-11-27 02:45:15
问题 On IIS 7, I'm trying to use custom HttpHandler for my ASP.NET web application. I use pipeline mode "classic", .NET version is 4.0.30319, my web.config configuration for the handler is: <system.webServer> <handlers> <add name="MyHandler" path="*.myExtension" verb="*" type="Company.App.UI.Controls.MyHandler, Company.App.UI" resourceType="Unspecified" /> </handlers> </system.webServer> When I invoke this handler, I get this error: HTTP Error 500.21 - Internal Server Error Handler "MyHandler" has

Async Await Handler Deadlock

随声附和 提交于 2019-11-26 23:11:36
问题 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[

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

霸气de小男生 提交于 2019-11-26 15:36:56
问题 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;

What is an HttpHandler in ASP.NET

会有一股神秘感。 提交于 2019-11-26 15:10:43
问题 What is an HttpHandler in ASP.NET? Why and how is it used? 回答1: 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

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

馋奶兔 提交于 2019-11-26 10:57:16
问题 This question already has answers here : How to use ASP.NET Session State in an HttpHandler? (4 answers) Closed 6 years ago . 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\");

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

僤鯓⒐⒋嵵緔 提交于 2019-11-26 10:46:14
问题 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