about "mojoPrincipal" method "IsInRole“

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.
5/25/2008 1:07:26 PM
Gravatar
Total Posts 2

about "mojoPrincipal" method "IsInRole“

Hi, 
I am a beginner,can't understand this 

public bool IsInRole(string role)
{
bool result = false;
if (this.innerPricipal != null)
{
result = this.innerPricipal.IsInRole(role);
}
.................
return result;
}

 a recursion? how it works ?
"HttpContext.Current.User.IsInRole(role)" used this method,or other

thks

5/26/2008 7:55:10 AM
Gravatar
Total Posts 18439

Re: about "mojoPrincipal" method "IsInRole“

Hi,

In your own custom code you should generally always use HttpContext.User and never have to worry about mojoPrincipal.

The only case where mojoPrincipal is used, is when hosting multiple sites on one installation using first level subfolder to determine the site.

At the bottom of the above linked page it talks about the limitations of this approach because all the sites use the same physical cookies because they share  the same host name. So the purpose of mojoPrincipal and mojoIdentity is to solve this problem by doing extra cookie checks to determine if the user .IsAuthenticated and .IsInRole for the current site. The innerPrincipal is the normal generic principle associated with Context.User and some of the work is still delegated to this principal but further checks are done by the outer containing mojoPrinciple when needed. You can see this innerPrinciple is really the Context.User object and it is passed into the constructor of mojoPrincipal in Global.asax.cs if needed during Application_AuthenticateRequest

If not hosting multiple sites this way the complext cookie checking logic is not needed or used.

Hope the explanation helps.

Best,

Joe

5/28/2008 1:54:13 PM
Gravatar
Total Posts 2

Re: about "mojoPrincipal" method "IsInRole“

get it

Thand You Very Much

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