Thursday, July 19, 2012

How to create session enabled web service?

Problem: How to enable session in web service?

Solution:  By default, ASP.NET session support for each Web method is turned off. You need to add EnableSession=true property for the WebMethod attribute.

For example look at the following code snippet:

    public static int SessionCounter()
        int counter=0;
        return counter;

You need to confirm that session state is enabled in web config file.

No comments:

Post a Comment