473,387 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Finding Email address in a Profile

I just started using The Login Objects and the CreateUserWizard creates a
number of fields including Email address and i cant figure out how to
reference it: intellisense tells me that Profile.Username is available, as
are all of my customised fieldnames - but where would i find the Email
Address?? All i want to do is assign the email address of the logged in user
to a string

Regards

Owen
Aug 24 '06 #1
1 1394
Hi Owen,

I think you'll find the email address is stored in a different place in the
database. You can get at it using one of the built-in views.

Here's some code that might get you pointed in the right direction. It feels
like a hack, so please post any improvements? See the inline comments for
details.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET[

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If Not IsPostBack Then
' By Ken Cox [Microsoft MVP]
' August 24, 2006
' Please improve on this hack! --kc
' Declare the dataview, sqldatasource
' and connection
Dim dv As New Data.DataView
Dim sqldsrc As New SqlDataSource
Dim connectionStrings As _
ConnectionStringSettingsCollection = _
System.Web.Configuration. _
WebConfigurationManager.ConnectionStrings
' Set the select command to use the built-in view
' and narrow the view down to the username
sqldsrc.SelectCommand = "SELECT Email FROM " & _
"vw_aspnet_MembershipUsers WHERE (UserName = 'kencox')"
' Make sure we are treating it as a text
' query rather than as a stored procedure
sqldsrc.SelectCommandType = SqlDataSourceCommandType.Text
' Tell the sqldatasource to return a dataset or datatable
sqldsrc.DataSourceMode = SqlDataSourceMode.DataSet
' Set the ID for good form
sqldsrc.ID = "sqldatasource1"
' Fetch the connection string from the web.config
sqldsrc.ConnectionString = connectionStrings.Item _
("ASPNETDBConnectionString").ConnectionString
' Get the retrieved data into the dataview by
' calling the Select method with no arguments
dv = sqldsrc.Select(DataSourceSelectArguments.Empty)
' Put the retrieved value from the "email" column
' into the label
Label1.Text = dv.Table.DefaultView(0).Item("email")
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Get the email address of a Membership row</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div>
<p>
&nbsp;<asp:label id="Label1"
runat="server"></asp:label></p>
&nbsp;</div>
</div>
</form>
</body>
</html>

"Owen Richardson" <Ow************@discussions.microsoft.comwrote in
message news:B5**********************************@microsof t.com...
>I just started using The Login Objects and the CreateUserWizard creates a
number of fields including Email address and i cant figure out how to
reference it: intellisense tells me that Profile.Username is available, as
are all of my customised fieldnames - but where would i find the Email
Address?? All i want to do is assign the email address of the logged in
user
to a string

Regards

Owen

Aug 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Picture Dots | last post by:
Ok - I want to check a string for @ in it (Im checking to see if a string that should contain an email holds a @ ) How would I go about this? preg_match? ereg? strstr?Examples? Also - how...
5
by: cfoley1970 | last post by:
I have an online directory of alumni from a high school that runs PHP with a MySql backend containing contact info, email addresses, etc. Some of the alumni have begun to complain about receiving...
1
by: Dhruv | last post by:
1. I'm trying to get the notifications working on the scheduled jobs. I want to email me when the job fails. I created an operator (dmalhotr) and given me as the email address. Here is the...
3
by: Chuck Farah | last post by:
I am unsuccessfullly trying to display an outlook email from a vb web forms (.net) outlook 2002 #1. is it possible to use outlook client email from a web form using the outlook object model...
2
by: FR3AK | last post by:
Hi. does anyone have any idea of how to find the mac address of a remote networking device? I've worked with WMI and it works fine as long as the target machine is a Windows computer, however,...
12
by: Amir Ghezelbash | last post by:
Hello every body I had a question I am involved in a project where I need to verify the user's email address by sending them an email and asking them to click on a link. now I have done this but...
4
by: Mike | last post by:
Hi all, In my recent ASP.NET 2.0 appl, I need to verify that the supplied email address is valid or not. So, here's my situation: - In my <profilearea, I created <isVerifiedproperty. - Suppose a...
8
by: shapper | last post by:
Hello, I am trying to send an email using Asp.Net 2.0. I am getting the following error: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: No such...
8
by: nargis2009 | last post by:
Hi, I have been encountering problems with my web page which is supposed to send email, and wondered if anybody can help find error. Initially I had all codes in one page and on click of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.