Solved

ASP.NET Profiles Query

Posted on 2011-03-06
2
263 Views
Last Modified: 2012-06-27
Hi

I've searched Google for this but cant get a definative answer.

Is there a way to check if a logged in user has a profile? or is it OK to try and read a profile and will it just return empty and not error if one is not found.

Andy
0
Comment
Question by:Andy Green
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 500 total points
ID: 35055096
Hi,

You can do some simple checking like this:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            If User.Identity.IsAuthenticated Then
                Dim up As ProfileCommon = Profile.GetProfile(User.Identity.Name)
                If Not up Is Nothing Then
                    lblResult.Text = "User has profile, last updated: " & up.LastUpdatedDate.ToLongDateString()
                Else
                    lblResult.Text = "User profile not created"
                End If
            End If
        End If
    End Sub

Open in new window


If Profile.GetProfile() returns nothing then up should be nothing as well. So simply just do the check and add the needed logic to manage this.

/Carl.
0
 
LVL 3

Author Closing Comment

by:Andy Green
ID: 35179083
Thanks
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question