[Mono-list] Implemented classes

Chris Turchin chris@turchin.net
Wed, 21 Jul 2004 08:10:49 -0700 (PDT)


Hi Valentina,

I can only comment on one:

> -->System.Web.SessionState.HttpSessionState (to use session variables with web
> services)

You need to explicitly indicate EnableSession for a web method if you are not
doing this already. Sample (tested and seems to work with asmx test form,
though the session was not persisted between clicks, I assume this is a
client-side issue but am not sure...):

<%@WebService Language="c#" class ="sumThis"%>
using System;
using System.Web.Services;
public class sumThis:WebService
{
        [WebMethod(Description="Accumulated sum over
session",EnableSession=true)]
        public int Add(int a,int b)
        {
                if (Session["sum"]==null)
                        Session["sum"] = 0;
                int sum;
                sum=a+b;
                Session["sum"]=sum;
                return Convert.ToInt32(Session["sum"]);
        }
}

Reference:

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

Regards,

--chris