Obtain the User in a SiteModuleControl or MojoBasePage

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
7/16/2009 2:15:31 PM
Gravatar
Total Posts 8

Obtain the User in a SiteModuleControl or MojoBasePage

Where is the best place to obtain a reference to the User that is logged in that is accessible to the SiteModuleControl and the MojoBasePage?

Thanks,
Evan

7/16/2009 2:21:35 PM
Gravatar
Total Posts 18439

Re: Obtain the User in a SiteModuleControl or MojoBasePage

Hi Evan,

This is an example of a common task that you should be able to find out how to do by looking at the source code for existing features, but I'll cut to the chase and tell you anyway, especially since you bought me beers ;-)

SiteUser currentUser = SiteUtils.GetCurrentSiteUser();

note that it will return null if the user is not authenticated so you should make sure your code will handle null as a return value.

Hope it helps,

Joe

7/16/2009 2:24:31 PM
Gravatar
Total Posts 8

Re: Obtain the User in a SiteModuleControl or MojoBasePage

Yeah, I found that just after I posted this.  Sorry for the frivolous question.  Been a long day already

7/16/2009 2:29:46 PM
Gravatar
Total Posts 18439

Re: Obtain the User in a SiteModuleControl or MojoBasePage

No worries at all, didn't mean to discourage questions, I just like to emphasize at every opportunity that the code was written to be read and meant to provide good examples that people can use in their own features.

Best,

Joe 

You must sign in to post in the forums. This thread is closed to new posts.