This is a migrated thread and some comments may be shown as answers.

Problem with RadScheduler, WebService & Session State

1 Answer 118 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Gordon Buxton
Top achievements
Rank 1
Gordon Buxton asked on 03 Oct 2012, 01:42 PM
I have a problem with webservice binding of RadScheduler on an ASP.NET forms application.  I need to be able to access Session state from my webservice code, and sometimes it works and sometimes it doesn't.

Specifically the client event OnClientResourcesPopulating does not maintain session state - I presume because it's not passing the current session state cookie to the webservice call.

I have set up a sample project showing the problem, which I set up using the example here: http://www.telerik.com/help/aspnet-ajax/scheduler-webservicebinding.html

The key parts are that in my Default.aspx I set a session variable like this:

namespace RSWSTest

{

    public partial class Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            if (!Page.IsPostBack)

            {

                Session["TestSessionValue"] = "MyTestValue";

            }

        }

    }

}


The page has a RadScheduler on it, configured to call a webservice.  Here's a snippet from the webservice code:

        [WebMethod(EnableSession=true)]

        public IEnumerable<ResourceData> GetResources(SchedulerInfo schedulerInfo)

        {

            object v = Session["TestSessionValue"]; //-- THIS RETURNS NULL

            Session["WS_GetResourcesCalled"] = true; //-- THIS WORKS BUT NOT VISIBLE IN SUBSEQUENT CALLS

            return Controller.GetResources(schedulerInfo);

        }

        

        [WebMethod(EnableSession=true)]

        public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)

        {

            object v = Session["TestSessionValue"]; //-- THIS RETURNS "MyTestValue"

            Session["WS_GetAppointmentsCalled"] = true;

            return Controller.GetAppointments(schedulerInfo);

        }


As you can see from my comments - it appears that the GetResources function starts a new session every time it is called, whilst the GetAppointments function seems to work as expected.

I need to find a solution to this as I have session-based user security and I want to return different things based on which user is stored in the current session.

I can't attach my test solution because it'll only let me post image files - but I can email it to someone if it would help - it's only 19k zipped!


1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 05 Oct 2012, 07:38 AM
Hello,

 I possible thing that may be causing the unusual behavior is the Mode of the resource Population. After setting the it to ClientSide as in the code below it worked as expected:

<telerik:RadScheduler ID="RadScheduler1" runat="server" Height=""HoursPanelTimeFormat="htt"
        ValidationGroup="RadScheduler1" SelectedView="WeekView"SelectedDate="2012-02-02"
  TimeZoneOffset="03:00:00" StartEditingInAdvancedForm="false">
        <WebServiceSettings Path="SchedulerWebService.asmx"ResourcePopulationMode="ClientSide" />
    </telerik:RadScheduler>

Hope this will help you solve the issue. 

All the best,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Gordon Buxton
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or