httphandler

Processing static files via HttpModule in ASP.NET

老子叫甜甜 提交于 2020-01-01 03:46:08
问题 I have statiс files in website folder, but need to check permissions for every file. I decided to use HttpModule for that purposes. ASP.NET receives all the http-requests (I used wildcard mapping) and The algorith is the following: HttpModule receives the request HttpModule checks permissions If access is denied then the answer is "Forbidden". If all is OK then httpModule's method just returns. DefaultHttpHandler is automatically used to process request for static files The problem is that

The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file

。_饼干妹妹 提交于 2020-01-01 01:17:11
问题 The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.web/httpHandlers section of the web.config file This error is coming . I have already mentioned this line in http handler but still getting this error <add path=

Response.Flush() throws System.Web.HttpException

戏子无情 提交于 2019-12-31 22:33:11
问题 I have a HttpHandler that I'm using to handle certain images on a client's website. When I'm outputting the image stream to the response object and call Flush occasionally an error is thrown. Here is a codeblock var image = Image.FromStream(memStream); if (size > -1) image = ImageResize.ResizeImage(image, size, size, false); if (height > -1) image = ImageResize.Crop(image, size, height, ImageResize.AnchorPosition.Center); context.Response.Clear(); context.Response.ContentType = contentType;

Significance of bool IsReusable in http handler interface

旧巷老猫 提交于 2019-12-31 07:57:29
问题 When writing a http handler/module, there is an interface member to implement called - bool IsReusable. What is the significance of this member? If I set it to false (or true), what does this mean for the rest of the web app? 回答1: The normal entry point for a handler is the ProcessRequest method. However you may have code in the class constructor which puts together some instance values which are expensive to build. If you specify Reusable to be true the application can cache the instance and

Posting forms to a 404 + HttpHandler in IIS7: why has all POST data gone missing?

不羁岁月 提交于 2019-12-31 02:54:10
问题 OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is sent to an .aspx file. This allows us to implement an HttpHandler to handle the request and do stuff, which involves finding the an associated template and then executing whatever

asp.net file downloading - track downloaded size

别等时光非礼了梦想. 提交于 2019-12-30 08:25:50
问题 I am trying to design a system for something like this with ASP.net/C#. The users pay for downloading some content (files- mp3s/PDFs,doc etc).I should be able to track the number of bytes downloaded by the user. If the number of bytes downloaded match the number of bytes on the server, I should set a flag in DB (telling that the download was successful and prevent them from downloading the file again/asking them to pay for the download again). If the download was incomplete, they should be

Mapping specific folder to HttpHandler in web.config

ε祈祈猫儿з 提交于 2019-12-30 06:21:28
问题 Is it possible to map all file extensions in a folder to a specific HttpHandler (assuming that their file extensions are mapped to aspnet_isapi.dll in IIS) ? I've got the FLV extension mapped to ASP.NET in IIS, and have a folder named Static in my web application with the following files: Static/Index.htm Static/MyFile.flv The index file is a basic html page using the JW FLV Media Player to play the FLV. In Web.Config, under the HttpHanders section, the following works (FLV is loaded and

IHttpHandler vs IHttpModule

断了今生、忘了曾经 提交于 2019-12-28 07:35:50
问题 My question is simple (although the answer will most likely not be): I'm trying to decide how to implement a server side upload handler in C# / ASP.NET. I've used both HttpModules (IHttpModule interface) and HttpHandlers (IHttpHandler interface) and it occurs to me that I could implement this using either mechanism. It also occurs to me that I don't understand the differences between the two. So my question is this: In what cases would I choose to use IHttpHandler instead of IHttpModule (and

File Upload using HTTPHandler

自作多情 提交于 2019-12-28 03:10:20
问题 I am trying to upload file ( multi part form data ) using HTTPHandler. WebKit Boundary is getting written to the destination file , thus corrupting the file. Input files can be any kind of files, including text, zip, apk etc. Code: public void handle(HttpExchange httpExchange) throws IOException { URI uri = httpExchange.getRequestURI(); String httpReqMethod = httpExchange.getRequestMethod(); Headers headers = httpExchange.getRequestHeaders(); InputStream inputStrm = null; FileOutputStream

ASP.NET MVC Retrieve localized resources programmatically

我们两清 提交于 2019-12-25 12:43:12
问题 I have a HTTP Handler that reads all resources files in the ASP.NET MVC assembly and converts them to a Javascript object. The code works well apart from 1 rather big detail as I need to be able to predefine the culture. I cannot use the useful web config's auto UI cultures, instead I want to use database configuration. As soon as this code runs, it still takes the local culture of my computer. Is there any way to set the culture? I was thinking of using the ResourceManager but I'm failing to