Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please help me how to enable session in asp.net api?, have any attributes for that?
Posted
Updated 24-Nov-19 23:29pm

The small issue about enable the session on the API call is you need to add to all the calls on teh API, on WebForms you can add only on teh call you need use the session. Fro me the most easy way is enable on the Global.asax.

protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
        {
            //implement session on api calls
                HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
        }


With this action you already can get a session from the API.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900