[Mono-devel-list] System.Web: Enable SessionState in HttpHandler (FrontController)

Chris Turchin chris at turchin.net
Thu Jun 3 04:38:39 EDT 2004


Hi,

you need to implement  IRequiresSessionState or
IReadOnlySessionState in your handler.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebsessionstateirequiressessionstateclasstopic.asp

Then it should work.

--chris



On Thu, 3 Jun 2004 yoros at wanadoo.es wrote:

>
> Hi,
>
> I'm using the FrontContrller pattern (described in MSDN web) using the
> following option in "web.config":
>
>     <httpHandlers>
>         <add verb="*" path="*.ctrl" type="Handler, FrontController" />
>     </httpHandlers>
>
> I have the problem that in the Handler class the SessionStateo object is
> not created (Session == null).
>
> Something as follows:
>
> -----------8<------------
> using System;
> using System.Web;
> using System.Web.UI;
> public class Handler : IHttpHandler {
>     public void ProcessRequest (HttpContext context) {
> 		context.Response.Write("Is SessionState null? " + (context.Session == null).ToString());
>     }
>     public bool IsReusable  {
>         get { return true; }
>     }
> }
> -----------8<------------
>
> To view the Session value:
>
> mkdir FrontController
> cd FrontController
> cat << '__EOF__' >> FrontController.cs
> using System;
> using System.Web;
> using System.Web.UI;
> public class Handler : IHttpHandler {
>     public void ProcessRequest (HttpContext context) {
> 		context.Response.Write("Is SessionState null? " + (context.Session == null).ToString());
>     }
>     public bool IsReusable  {
>         get { return true; }
>     }
> }
> __EOF__
> cat << '__EOF__' >> web.config
> <?xml version="1.0" encoding="utf-8"?>
> <configuration>
>     <system.web>
>         <httpHandlers>
>             <add verb="*" path="*.ctrl" type="Handler, FrontController" />
>         </httpHandlers>
>     </system.web>
> </configuration>
> __EOF__
> cp /usr/local/bin/xsp.exe . # change /usr/local/bin with the path of xsp.exe
> mkdir bin
> mcs FrontController.cs /out:bin/FrontController.dll /target:library /r:System.Web.dll
> ./xsp.exe
>
> Go to http://localhost:8080/something.ctrl in any browser...
>
> Can anybody help me with this issue? Is it a bug?
>
> Regards,
>
>     Pedro
>
> --
> Pedro Martínez Juliá
> \  pmj3 at alu.um.es
> )|    yoros at wanadoo.es
> /        http://yoros.dyndns.org
> Socio HispaLinux #311
> Usuario Linux #275438 - http://counter.li.org
> GnuPG public information:  pub  1024D/74F1D3AC
> Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



More information about the Mono-devel-list mailing list