A InitialiationModule run during startup of the site so you will propably not have any current session at that stage. You need to same/get that property from something else.
What do it do and when do you set the value in the session
Hi @Henrik Fransas,
Thanks for your answer. Let me describe the way i do that.
I created an InitializationModule to generate properties for page, the page type has some properties [Editable(false)] and only generate when created page.
And I also need create an admin plugin to generate property for all of pages in my system because before that, their properties haven't initialized yet. But when i run the plugin, it has a problem about saving page (conflict with InitializationModule). So i tried use Session to check the page is edited by plugin or user, and i get this issue.
Do you have any idea for my isse?
Thank you very much.
Why do you not just use SetDefaultValue?
What is PropertyPageLocator?
Ah because those properties dependent value user input.
PropertyPageLocator is just a module to update properties for page. You don't need to pay attention to it.
Oh i detected when i run plugin, session != null and when i edit page, session == null in InitializationModule :D.
Thank you beacause of your suggestion.
So you solved it, great! :-)
I'm having an issue, that is use HttpContext.Current.Session. I want check existence of a session variable, but if it doesn't exist, my project will display "Object reference not set to an instance of an object."
This is my code.
Anyone can resolve this? Thank you :)