Session state null in profile provider

A

ashish

hi all,

I am writing a custom profile provider to save my business object as one
of the properties of the profile

however i am facing a problem'

the HttpContext.Current.Session property is valid in in the Get
PropertyValues method,

but its null in the SetPropertyValues method

is this how its supposed to work ?, i checked my web.config and session
is enabled, i can also confirm that session variables are working
properly on pages ...


Thanks
 
G

Guest

Hi Ashish,
This is because the ProfileProvider will save the values in its
properties to the datastore at the end of each request as its
'automaticSaveEnabled' attribute is true by default. And at the end of
request, the session will not be available as its life time expires before
request ends.

Solution:
In the web.config, set "automaticSaveEnabled = false" in the profile tag.
In this case you will have to call Profile.Save() method explicitely to save
the profile values to the datastore.

Regards
Ranji.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top