This is the error message i get

This was the exception:

An exception of type 'System.NullReferenceException' occurred in
XX.XXX.XXXX.DLL but was not handled in user code
Additional information: Object reference not set to an instance of an
object.


Thanks
Kcube


On May 18, 5:00 pm, Kcube <[email protected]> wrote:
> i have tried with the below snippet.. but its not working
>
>   protected override void Initialize()
>         {
>             UserProfile user = (UserProfile)this.Context.Session
> ["GBL_CURRENT_USER"];
>             IUserProfile objUserProfile = (UserProfile)
> this.Context.Session["GBL_CURRENT_USER"];
>
>             PropertyBag["usernameforemsa"] = "test User";
>
>             base.Initialize();
>         }
>
> session object is null
>
> Thanks
> Kcube
>
> On May 18, 4:40 pm, Kcube <[email protected]> wrote:
>
>
>
> > thanks very much
>
> > On May 18, 4:27 pm, Jimmy Shimizu <[email protected]> wrote:
>
> > > Override the Initialize()-method in your controller, there you should
> > > have access to the http-context and the session, I think.
>
> > > Kcube wrote:
> > > > How get session variable inside layout.
>
> > > > I have tried these many methods, but couldn't find a good one
>
> > > > 1) I want to show the logged-in user name in layout page. I have
> > > > tried
> > > > to access the session  variable inside the controller and set the
> > > > value to property bag and then access it in layout page $username.
>
> > > > 2) I have inherited the controller from a base page and in the base
> > > > page constructor i tried to access session, but i am not able to
> > > > access the session inside the constructor.
>
> > > > 3) I am able to access the session inside filter, but property bag is
> > > > not available inside filter.
>
> > > > I am sure this is not proper mechanism to access the session variable
> > > > in side layout. Can anyone help me please?
>
> > > > Sorry for asking basic question. Thanks in advance- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to