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

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...II'll pay $50 USD to the first programmer to solve this
Previous
 
Next
New Post
8/29/2011 8:14 AM
 
Good question.  Maybe I can use the framework.  I've never used it and don't do module development.  The .aspx I wrote is simply a way to have the user download a file from the portal via a direct link without logging in to DNN and it also hides the file location from the user for security.  So it works like www.mysite.com/download.aspx?file=myfile.pdf  So the user need not log in to DNN to see the file, but if they have logged in prior I'd like to pick up their username from the cookie so I can track who did the download.  If there is no DNN cookie for the site, then the tracking occurs with no username since no login is required.
 
New Post
8/29/2011 8:57 AM
 
Make sure in your ASPX page that you inherit from DotNetNuke.Framework.PageBase instead of Page. Once you do this then the following code should work. I'm not exactly sure what you want to do but the code below makes sure the user is authenticated then fills a UserInfo object you can use. If all you want is the username then you could just use "HttpContext.Current.User.Identity.Name".

If (HttpContext.Current.Request.IsAuthenticated) Then
Dim user as DotNetNuke.Entities..Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(PortalSettings.PortalId, HttpContext.Current.User.Identity.Name)
End If


Hope that helps.

Will

Will Morgenweck
VP, Product Management
DotNetNuke Corp.
 
New Post
8/29/2011 9:00 AM
 

You can have your page use any inheritance heirarchy that makes sense for your application and just call into the user controller.  Because I am using the GetCurrentUserInfo, I can now access any of the user's information, like email, login ID, real name, or any of their profile data.

<%@ Page Language="VB" AutoEventWireup="false"  %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml...">
 
<head runat="server">
    <title></title>
</head>
<body>
  <script runat="server">
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
      If Request.IsAuthenticated Then
        lblUserName.Text = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().DisplayName
      Else
        lblUserName.Text = "Unknown User"
      End If
 
    End Sub
  </script>
 
    <form id="form1" runat="server">
 
    <asp:Label ID="lblUserName" runat="server" Text="Label"></asp:Label>
 
    </form>
</body>
</html>


Joe Brinkman
DNN Corp.
 
New Post
8/29/2011 9:06 AM
 
Also, if you haven't already signed up, I would recommend you consider going to DotNetNuke World in Orlando and attend a pre-conference class if you can.  The amount you will learn in 3 days is well worth the time and expense as you'll have 3 days of learning from people like Will Morgenweck and many other DotNetNuke experts. http://dotnetnukeworld.dotnetnuke.com/

Joe Brinkman
DNN Corp.
 
New Post
8/29/2011 8:13 PM
 
Thanks Joe and Will. I'll give these a try and let you know.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...II'll pay $50 USD to the first programmer to solve this


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