UserID for logged in user

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/7/2012 12:52:33 PM
Gravatar
Total Posts 9

UserID for logged in user

We would like to access the "USERID" as well as the Email address of the currently logged in user.

Specfically we need pass this information thru the URL on the Create new Page in the Admin page settings section to make that part of the main navigation

example http://www.mywebsite.com/login.aspx?userid=$userID$

something along those lines, is this possible or are there any other ideas out there that will allow for this?

5/7/2012 2:58:08 PM
Gravatar
Total Posts 18439

Re: UserID for logged in user

Hi,

I don't really understand your question or what you are trying to do, your questions don't really make sense to me.

For the current logged in user you can get his LoginName (its just labeled UserID on the login screen or hist actual UserID which is an integer from code as follows:

SiteUser currentUser = SiteUtils.GetCurrentSiteUser();

string loginName = currentUser.LoginName;

int userId = currentUser.UserID;

I don't know what you mean about passing it from Page Settings or making it part of navigation, you should not be modifying mojoPortal code.

I cannot imagine why you would need to pass anything to a custom login page for a user who is already logged in and passing things like loginname in the query string would not be good security, the main reason to use LoginName (ie it is what users use to login when Use Email for Login is NOT checked in Site Settings and the only benefit of using that is that it is less guessable than email).

Hope that helps,

Joe

5/8/2012 4:17:38 PM
Gravatar
Total Posts 9

Re: UserID for logged in user

Thanks Joe, what I am trying to do is avoid the user from needing to login to another system of ours. We have a proposal creation system that the staff and advisors use and we wanted to add that to the navigation of the mojoportal site we run. For example XYZ Proposal would then link to our proposal system and allow for them to access it so long as they were already logged into mojoportal. We were hoping to do that with a session variable, reading in a cookie or some other means to treat it as a single sign on. Does that make more sense?

5/11/2012 8:24:23 AM
Gravatar
Total Posts 9

Re: UserID for logged in user

Are there any ideas out there to accomplish something like this without the modification of the mojo portal code base?

5/11/2012 8:36:36 AM
Gravatar
Total Posts 18439

Re: UserID for logged in user

If your other app is running as an IIS application in a folder beneath a root site running mojoPortal and in the same domain then you should be able to access cookies between them, though you won't be able to read the authentication cookie from mojoPortal in the sub app since it is encrypted using the machine key. You could potentially set an extra cookie by implementing a custom user sign in event handler in mojoPortal, and then read the custom cookie in the sub app and use that to log them in to the sub app.

I don't know if you can share session state between them, I definitely would not implement something that does an automatic login based on a query string param as that would be very insecure.

Hope that helps,

Joe

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