Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...GetCurretnUserInfo not returning dataGetCurretnUserInfo not returning data
Previous
 
Next
New Post
6/15/2007 4:47 PM
 

I am trying to use the GetCurrentUserInfo method, but all it returns me is an empty UserInfo object.

Here is my Code:

Dim objUserInfo As New Entities.Users.UserInfo

objUserInfo = UserController.GetCurrentUserInfo()

Simple (I Thought)

 

 
New Post
6/15/2007 5:05 PM
 

its even simpler than that. If you want to get info on the current user from within a module control, just use Me.UserInfo. This will contain the current userinfo object


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
6/15/2007 5:31 PM
 

Ok, let's get a little deeper.  I am not building a module, I am building a web service.  When I use the Me keyword all I get is user. No UserInfo.

Here is the web service:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports DotNetNuke

Namespace DotNetNuke.Modules.PSI

    <WebService(Namespace:="http://PSI/MyWebServices")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class MyWebServices
        Inherits System.Web.Services.WebService

        <WebMethod()> _
        Public Function GetUserInfo() As String


            Dim objUserInfo As New Entities.Users.UserInfo

     objUserInfo = UserController.GetCurrentUserInfo()

            Return objUserInfo.DisplayName
           
        End Function

    End Class
End Namespace

 
New Post
6/15/2007 6:13 PM
 

if you are calling a webservice, you need to authenticate before you will be able to get a userinfo object. Mind you: webservices are not authenticated using the normal dnn forms authenticated

I'd suggest you take a look at Michael Washington's work on IWeb: http://iweb.adefwebserver.com/


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
6/15/2007 7:24 PM
 

Please note, your current code is probably not working as it requires an authenticated user to be logged in, it's always wise to check for this, or replace it e.g. something like

if request.isauthenticated=true then

'check for username here

or

if (dotnetnuke.Entities.Users.UserController.GetCurrentUserInfo.Username IsNot Nothing) then ....

or

IIf(Request.IsAuthenticated,HttpContext.Current.User.Identity.Name, "Not logged in") ...


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...GetCurretnUserInfo not returning dataGetCurretnUserInfo not returning data


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out