httphandler

asp.net mvc routing to a custom handler instead of controller?

I have a custom handler I've written that executes a custom action based on a parameter, for example: /action/option1 would execute the action handler with option1. I can have any number of options for the parameter... however this action is a custom handler, NOT an mvc controller, because I'm returning a plain text (possibly moving t...

Returning a file using asp.net mvc ?

I have a custom IHttpHandler which is used by thick clients to download files using a url such as http://url.ashx?id=123&version=456 the code handler basically ends with context.Response.WriteFile(myLocalServerPath); Is it possible to replace this using the typical asp.net mvc controller pattern ? ...

SharePoint search web service error (NTLM) when called from HttpHandler

Here is my scenario: I have a SharePoint site I am working on, and it is on one server farm. In this site, I have created an HttpHandler that uses a SharePoint search webservice that is located on a different server. So that looks something like this: SharePoint Server A, where my site lives Has a service reference to SharePoint searc...

HttpHandler in IIS7 and Visual Studio 2010

Hello, I'm trying to run an httphandler (ashx) in a asp.net 4 website. When I call it from Visual Studio integrated server, it returns a 404 error. It works if I call it on the site configured into the local IIS. Someone could help? ...

Use routing in HTTPHandler

Hello, I want to use HTTP Handler in order to create a RSS feeds. For the purpose, I want to put my logic for creating the rss XML in C# class, which implement IHttpHandler, then to "map" this handler into the web.config file and to register the "mapped name" in my routing rules. I am doing something like this: My HTTPHanlder: ...

HTTPHandler vs .aspx

What are the advantages of using an HTTPHandler vs an .aspx? Does it have the same capabilities and is it lighter weight and faster? What are some of the disadvantages? ...

MVC HttpDelete Verb causing 405 Method Not Allowed

Hi All, I'm encounting a method now allowed exception when calling a controller action which accepts the Delete verb. I thought the problem was that the HandlerMappings in IIS 7.0 were wrong and when I looked at: ExtensionlessUrl-ISAPI-4.0_64bit ExtensionlessUrl-ISAPI-4.0_32bit ExtensionlessUrl-Integrated-4.0 Sure enough they didn'...

Construtor/Setter Injection using IoC in HttpHandler, is it possible??

Hi. I've ran into a rather hairy problem. There is probably a simple solution to this but I can't find it! I have a custom HttpHandler that I want to process a request, log certain info then enter the details in the database. I'm using NUnit and Castle Windsor. So I have two interfaces; one for logging the other for data entry, which a...

How do I get the Silverlight Pivot Server application to run on IIS 6?

How do I get the Pivot Server Application to run on IIS 6? The handlers for the cxml don't seem to be registering properly, because I get a 404 for requests to .cxml files. The closest solution I can see so far is on http://forums.silverlight.net/forums/p/192470/454278.aspx , but this doesn't seem to be the right way to do it. I see th...

Preserve Session Variables Across HttpHandlers

I have an ASP.NET application with 5 .ashx HTTPHandlers that implement IRequiresSessionState or IReadOnlySessionState. Upon calling the first handler I create a variable and store it in the session. When I call the next HttpHandler the variable is not available in the session object. I am use context.Session. I have a global.asax whe...

Sending Html data to HttpHandler and fetch it from within handler.

I am formatting html in my admin page and wants to send this html as part of Response object. I am redirecting to HttpHandler (Preview.ashx) using Response.Redirect, but how am I supposed to send that html within response and read it from httphandler using HttpContext object in my Handler? ...

Unit testing async httphandler

If you have a Async HttpHandler as described here, how would one unit test? Would you create instance of the handler class itself or/and the IAsychResult class as well? Any example would be great.. Thx! ...

Using IoC container as a service locator for HttpHandler

This question relates to my other post. Ok so after a bit more messing around I decided to do it this way. Which seems to work fine when I run it, although I'm getting the following error in NUnit: Could not load file or assembly 'Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies....

How to access localised resources in an .ashx file?

I have an ashx file which returns a localised message. This is called from an Ajax request. I need to access the Asp.net ResourceManager in the ashx file. ...

Mocking, Unit Testing (NUnit) setup problem with HttpHandler

This post relates to two other posts, here and here. I'm new to Unit Testing & Mocking. I have a test fixture that is trying to mock a HttpContext object including the response and request. I think the test code is not setup properly, as after calling the handler I get an error immediately. There error I am getting is: UnitTests.UADHan...

C# HttpHandler Path and SSL

Hey All, I have an HttpHandler which resizes images and works great for JPG, GIF, and PNG. The issue I am having is two fold. 1) If I try to navigate to a page with an image on it via SSL (https://...) then the lock doesn't appear in the title bar in IE or FF. I have confirmed this is due to the image. If I remove the handler the lo...

Error 500 with custom HttpHandler in ASP.NET website (IIS 7.5, Win7)

Hi I'm trying to get custom HttpHandler working in my sample web application. I've been experiencing a lot of issues, but finally got stuck with error 500. Application pool is being run in Classic ASP.NET 2.0 mode. Server is IIS 7.5, OS is Win 7 Pro. Here's a code of my handler: public class SampleHandler : IHttpHandler { public ...

HttpContext at Handler

For protect download files purposing I created http handler liket this: public void ProcessRequest(HttpContext context) { string user = HttpContext.Current.User.Identity.Name; FilePermissionHelper helper = new FilePermissionHelper(user); string path = context.Request.Form["file"]; bool canDownload = h...

SharePoint 2007 HttpHandler NullReferenceException using SPContext.Current.Site/Web when called from jQuery

I have the need to develop a custom HttpHandler in SharePoint. To start, I just coded up a simple example: http://pastebin.com/HXLjR2xT. On line 35 or 36 of that code I get a NullReferenceException thrown if I call my HttpHander page from jQuery. But if I call the page directly in my browser, I get the results I expect. I have seen some ...

File-handle "leaks" caused by HttpHandler?

Hello, I am experiencing a really curious problem with a HttpHandler and I am hoping someobody here might be able to shed light on this. Many thanks in advance for reading this. We have created a HttpHandler that sits in the pipeline of an IIS website that serves images, videos, and other assets. The HttpHandler is very lightweight. It...