ihttphandler

Webclient using download file to grab file from server - handling exceptions

我只是一个虾纸丫 提交于 2019-12-24 00:55:44
问题 I have a web service in which I am manipulating POST and GET methods to facilitate upload / download functionality for some files in a client/server style architecture. Basically the user is able to click a button to download a specific file, make some changes in the app, then click upload button to send it back. Problem I am having is with the download. Say the user expects 3 files 1.txt, 2.txt and 3.txt. Except 2.txt does not exist on the server. So I have code like (on server side): public

Error when calling MvcHttpHandler.ExecuteRequest from custom IHttpHandler

删除回忆录丶 提交于 2019-12-21 10:46:28
问题 I have a custom IHttpHandler that calls MvcHttpHandler implemented as described in this answer. It worked well in asp.net MVC2, but after I migrate the code to MVC4 with IISExpress 7.5, I start getting InvalidOperationException on the line: httpHandler.ProcessRequest(HttpContext.Current); with message: 'HttpContext.SetSessionStateBehavior' can only be invoked before 'HttpApplication.AcquireRequestState' event is raised. ASP.NET Development Server does not make any problems. Does anyone know

POST json object array to IHttpHandler

别来无恙 提交于 2019-12-21 06:45:54
问题 Im constructing an array of objects like this: var postData = []; $.each(selectedFields, function (index, value) { var testTitle = 'testing ' + index; postData.push({title: testTitle, title2 : testTitle}); } I then post it like this(note that i have tried a number of different aproaches): $.post('SaveTitlesHandler.ashx', { form : postData }, function (data) { console.log(data); }); I then try to get the data in a handler... public class SaveTitlesHandler : IHttpHandler { public void

Filehandler in asp.net

情到浓时终转凉″ 提交于 2019-12-17 09:58:35
问题 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. 回答1: Create an

IHttpHandler file transfer Progress?

落花浮王杯 提交于 2019-12-13 00:38:30
问题 I have a simple IHttpHandler for chunked file transfer, and in the client code i'd like to report progress of percentage of the file, in the past I did it by dividing the amount of bytes transferred by the file size in bytes, and then make an event when it reached every 10% which I know is not the best method. I pulled out all that code regardless, but is there a better way to do it in the method I am using below? //IHTTPMethod //Open file string file = System.IO.Path.GetFileName

“Invalid use of response filter” when compressing response from an IHttpHandler

不问归期 提交于 2019-12-12 19:27:47
问题 I have an IHttpHandler returning a file. When the response stream is compressed, either automatically using Telerik RadCompression or by explicitly setting a filter using context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress); the response returned to the browser is correct but at the end of the response is some HTML. The HTML contains the exception: [HttpException (0x80004005): Invalid use of response filter] System.Web.HttpResponseStreamFilterSink

Why don't ASP.Net handlers support session by default

别等时光非礼了梦想. 提交于 2019-12-12 04:38:18
问题 I understand that in order for a ASP.Net handler to support session state you need to implement both IHttpHandler and IRequireSessionState , but why isn't session state provided by default? If for performance reasons, then wouldn't it be better to have an interface like IDoesNotRequireSessionState ? 回答1: Its because the session is block the asynchronous operations, and the handle is usually used for long time operations, like the making and download of a file - if you keep the session on long

Can't get jQuery AutoComplete to work with External JSON

限于喜欢 提交于 2019-12-12 03:29:22
问题 I'm working on an ASP.NET app where I'm in need of jQuery AutoComplete. Currently there is nothing happening when I type data into the txt63 input box ( and before you flame me for using a name like txt63, I know, I know... but it's not my call :D ). Here's my javascript code <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js" type="text/javascript"><

HTTP Handler not being invoked

孤街浪徒 提交于 2019-12-12 01:29:19
问题 I have a custom HTTP Handler that properly implements IHttpHandler. Below is what I've configured in my webConfig. If I understand correctly this block should capture any requests with .test as the extension. <handlers> <add name="SampleHandler" verb="*" path="*.test" type="TestApp.App_Start.CustomHandler, TestApp" /> </handlers> However, the only time this handler is ever invoked is when I have a path depth of three applied to the request URL. All other requests will 404. For instance the

How do I get a custom IHttpHandler to Be Capable of Handling Postbacks?

痞子三分冷 提交于 2019-12-12 01:17:42
问题 I am writing a custom HTTP handler to provide an edit form for a grid using existing user controls. Basically, my handler creates the page, form, header, and other controls necessary to be able to render the existing user controls properly and at the end of ProcessRequest, I use Server.Execute to execute the page that was dynamically created. I am doing this because the solution where this resides is a user controls project and there are no pages, nor can we add any. This needs to be reusable