You were right Matt, it works. I tried something similar a while ago but
forgot to place the cs in app_code.
Not enought experience with ASP.net assumingly.
"Ivonne Riedel" <ivonneundlars@t-online.de> schrieb im Newsbeitrag
news:dr85a3$72t$02$1@news.t-online.com...[color=blue]
> Hi Matt,
>
> I read in an article that it should be possible (various ones to be
> precise).
> E.g.
http://cs.swan.ac.uk/~csneal/Reliabl...ceExample.html
> I will try the second option you gave me as I needed compiled code for
> speed matters and to pass parameters.
> Thanks so far
>
> Ivonne.
>
> "Matt Dinovo" <matt_at_swiftus_dot_com> schrieb im Newsbeitrag
> news:eHChD7bIGHA.1124@TK2MSFTNGP10.phx.gbl...[color=green]
>> Due to the new way ASP.NET projects are compiled, you have one of two
>> choices here:
>>
>> First, you could combine everything into your ASHX file (see below):
>>
>> <%@ WebHandler Language="C#" Class="MyNamespace.handlerpur" %>
>>
>> using System;
>> using System.Web;
>>
>> namespace MyNamespace
>> {
>> public class handlerpur : IHttpHandler
>> {
>> public void ProcessRequest (HttpContext context)
>> {
>> context.Response.ContentType = "text/plain";
>> context.Response.Write("Hello World");
>> }
>>
>>
>> public bool IsReusable
>> {
>> get {return false;}
>> }
>> }
>> }
>>
>> Or you could put the handlerpur.cs file in your App_Code directory so
>> that it's compiled into the web project DLL and then your ASHX file would
>> only have the webhandler directive:
>>
>> <%@ WebHandler Language="C#" Class="MyNamespace.handlerpur" %>
>>
>> I don't believe that the WebHandler directive allows for 'code behind'
>> files like a page does.
>>
>> HTH,
>>
>> Matt Dinovo
>>
>>
>>
>> "Ivonne Riedel" <ivonneundlars@t-online.de> wrote in message
>> news:dr7tbq$bb1$03$1@news.t-online.com...[color=darkred]
>>> Hi everybody,
>>>
>>> I have got a serious problem building an HTTPHandler in codebehind
>>> style.
>>> I made the following steps:
>>> Create an ASP .net Website project
>>> Add a generic handler.
>>> Rewrite this "Hello World" item into codebehind style so that the .ashx
>>> file has the only line:
>>> <%@ WebHandler Language="C#" Class="handlerpur"
>>> CodeBehind="handlerpur.ashx.cs" %>
>>>
>>> The codebehind file has the rest of the former content of the ashx file:
>>>
>>> using System;
>>> using System.Web;
>>>
>>> namespace MyNamespace {
>>> public class handlerpur : IHttpHandler {
>>> public void ProcessRequest (HttpContext context) {
>>> context.Response.ContentType = "text/plain";
>>> context.Response.Write("Hello World");
>>> }
>>>
>>>
>>> public bool IsReusable {
>>> get {
>>> return false;
>>> }
>>> }
>>> }
>>> }
>>>
>>> Trying to build that I get the error:
>>> Could not create type 'myNameSpace.handlerpur' pointing at the first
>>> line of the ashx file.
>>> I checked permissions, the virtual directory on the iis (it has got an
>>> app name), added things to the web.config, checked the framework version
>>> on the iis.
>>> Am I missing something? I do not have a bin directory in my project and
>>> nothing gets compiled.
>>> I am running WinXp SP2, iis 5.1, ASP.net 2.0.50727.
>>>
>>> Any help is greatly appreciated
>>>
>>> Thanks
>>>
>>> Ivonne.
>>>
>>>[/color]
>>
>>[/color]
>
>[/color]