views:

209

answers:

2

If you are developing multiple modules on a webpage displaying different things such as content like a bio or pictures based on a userId passed through the Query String.

At page load should all modules on the webpage act independently and individually look at the query string and return the content based on the userId.

And in the same way should the modules individually check if the correct user is logged in before they are allowed to modify the content.

I have made a one or two modules before for a website but this is the first time I am developing a DotNetNuke website and I am just unsure if this is the only way.

+2  A: 

Each module should work independently of the other ones.

Also, I don't think you should look at the querystring to get your user id because that can be spoofed. Instead, look at the base class for your module to see if there is a property containing the user info.

Chris Lively
+5  A: 

Your user control should already inherit from DotNetNuke.Entities.Modules.PortalModuleBase. If so, you can use the this.UserInfo.UserID property to retrieve the User's ID. This will be much safer than looking at the query string. Remember that the user may not be logged in, and in that case the above would cause a null reference - so be sure to test for null first.

Also, on a somewhat related note, you can use this.UserInfo.IsInRole("RoleName") to test to see if a particular user is in a given role.

Ian Robinson
Thanks for the extra help
shad