displaying user data after they register

 hi,

 

I have successfully made user wizard with MS access db.

Now im stuck. 

I would like that user can go to the page where they could change email or signature, but i dont know how to do it. I made detail list, but it always points me to ID 1, even though its ID is 2.

The tables  from MS access db aspnet_Membership,aspnet_Users,  etc...are not visible when i try to configure data source for detail list, so i build a query but didnt work

Is there a video or some info somwhere where i can see how to do it as i search almost everywhere with no luck.

 thank you

 

0
Urko
5/3/2009 5:57:01 PM
asp.net.security 27051 articles. 1 followers. Follow

11 Replies
1216 Views

Similar Articles

[PageSpeed] 3

 anyone? :(

0
Urko
5/4/2009 3:10:31 PM

 would like that user can go to the page where they could change email or signature, but i dont know how to do it. I made detail list, but it always points me to ID 1, even though its ID is 2.

Can you provide more details on what you did?

The tables  from MS access db aspnet_Membership,aspnet_Users,  etc...are not visible when i try to configure data source for detail list, so i build a query but didnt work

So you are using Access Memberhip Provider correct?


/GuruBhai
0
guru_sarkar
5/4/2009 3:59:21 PM

Hi guru_sarkar

 

guru_sarkar:

Can you provide more details on what you did?


I created detailView from aspnet_Membership and aspnet_User table. However when i got to myprofile.aspx page it always show first record from the database. It's not showing the correct user datas.

 I would that users once they register, got to myprofile.aspx page, where can change its details (like here on forum) where i can change email address or signature.

 

guru_sarkar:

So you are using Access Memberhip Provider correct?

yes im using  Access Memberhip Provider.


QueryBuilder:
SELECT aspnet_Membership.UserId, aspnet_Users.UserName, aspnet_Roles.RoleName, aspnet_Membership.Email, 
aspnet_Membership.PasswordQuestion, aspnet_Membership.PasswordAnswer, aspnet_Membership.IsApproved,
aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment, aspnet_Membership.Avatar

FROM aspnet_Roles, (aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId)
 
0
Urko
5/4/2009 4:20:39 PM

looks you are not passing the logged-in userID to the query to filter the data...

Sample code to get logged-in UserID:

 // Get a reference to the currently logged on user      

MembershipUser currentUser = Membership.GetUser();      

// Determine the currently logged on user's UserId value      

Guid currentUserId = (Guid)currentUser.ProviderUserKey;

Also check this to get some more idea: http://www.asp.net/learn/security/tutorial-08-cs.aspx


/GuruBhai
0
guru_sarkar
5/4/2009 4:29:49 PM

So i should write that in code behind? im using C#....

I did found this tutorial before but i just couldnt make it to work with my data...

sorry to asking u so many question but i just started to work in asp.net so everything is still pretty much new to me and i dont understand the code yet :)

0
Urko
5/4/2009 5:09:54 PM

yes that should go in the code-behind...

The tutorial uses DetailsView and SqlDataSource ... has select Parameter as UserId whose value is set in the code-behind.

Check step -2.

What problem you faced with the tutorial code?

 


/GuruBhai
0
guru_sarkar
5/4/2009 5:32:24 PM

 I just can't make it to work...if i do: WHERE aspnet_Membership.UserId= ?) then i get empty result...

 

I noticed that in step two the new table is created UserProfile...i did that and still got empty results...not sure what im missing..

im not good yet with writing code behind so is there a way to display dat afrom aspnet_User and aspnetMembership.

0
Urko
5/4/2009 6:07:18 PM

can you post your markup of page where you are trying to display the user info and anything in code-behind?


/GuruBhai
0
guru_sarkar
5/4/2009 8:34:19 PM

 This is my aspx page...there's no code behind yet as i didnt know what exactly to write yet...im still reading the tutorial but just cant make it to work.


 

<div id="Container">
<div class="Naboj-Header"><h2>Reloading Desk
</h2></div>
<div class="Tabs-Container">

<br />
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
 <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1"
Font-Bold="False" Width="930px">
<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Reloading Desk">
<HeaderTemplate>
Reloading Desk
</HeaderTemplate>
<ContentTemplate>
<br />
Živjo
<asp:LoginName ID="LoginName1" runat="server" />
...kako si kaj danes?
<br />
<br />
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Moje nastavitve">
<HeaderTemplate>
Moje nastavitve
</HeaderTemplate>
<ContentTemplate>
<br />
<asp:LoginName ID="LoginName2" runat="server" />
<br />
<br />

<br />
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="AccessDataSource1" Height="50px"
Width="125px">
<Fields>
<asp:BoundField DataField="UserId" HeaderText="UserId"
SortExpression="UserId" />
<asp:BoundField DataField="UserName" HeaderText="UserName"
SortExpression="UserName" />
<asp:BoundField DataField="RoleName" HeaderText="RoleName"
SortExpression="RoleName" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:BoundField DataField="PasswordQuestion" HeaderText="PasswordQuestion"
SortExpression="PasswordQuestion" />
<asp:BoundField DataField="PasswordAnswer" HeaderText="PasswordAnswer"
SortExpression="PasswordAnswer" />
<asp:CheckBoxField DataField="IsApproved" HeaderText="IsApproved"
SortExpression="IsApproved" />
<asp:BoundField DataField="CreateDate" HeaderText="CreateDate"
SortExpression="CreateDate" />
<asp:BoundField DataField="LastLoginDate" HeaderText="LastLoginDate"
SortExpression="LastLoginDate" />
<asp:BoundField DataField="Comment" HeaderText="Comment"
SortExpression="Comment" />
<asp:BoundField DataField="Avatar" HeaderText="Avatar"
SortExpression="Avatar" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/Orozje-Reloading-Center.mdb"

SelectCommand="SELECT aspnet_Membership.UserId, aspnet_Users.UserName, aspnet_Roles.RoleName, aspnet_Membership.Email, aspnet_Membership.PasswordQuestion, aspnet_Membership.PasswordAnswer, aspnet_Membership.IsApproved, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment, aspnet_Membership.Avatar FROM (aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId), aspnet_Roles"
UpdateCommand="SELECT aspnet_Membership.UserId, aspnet_Users.UserName, aspnet_Roles.RoleName, aspnet_Membership.Email, aspnet_Membership.PasswordQuestion, aspnet_Membership.PasswordAnswer, aspnet_Membership.IsApproved, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment, aspnet_Membership.Avatar FROM (aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId), aspnet_Roles">
</asp:AccessDataSource>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Spremeni geslo">
<HeaderTemplate>
Spremeni geslo
</HeaderTemplate>
<ContentTemplate>
<br />
<asp:ChangePassword ID="ChangePassword2" runat="server">
<SuccessTemplate>
<table border="0" cellpadding="1" cellspacing="0"
style="border-collapse:collapse;">
<tr>
<td>
<table border="0" cellpadding="0">
<tr>
<td align="center" colspan="2">
Change Password Complete</td>
</tr>
<tr>
<td>
Your password has been changed!</td>
</tr>
<tr>
<td align="right" colspan="2">
 </td>
</tr>
</table>
</td>
</tr>
</table>
</SuccessTemplate>
</asp:ChangePassword>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel4" runat="server" HeaderText="Moje polnitve">
<ContentTemplate>
hjkgjhghjgjhghj
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel5" runat="server" HeaderText="Priljubljene polnitve">
<contentTemplate>
sdfsdfs fdsfsdf
</contentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel6" runat="server" HeaderText="Moji videi">
<contentTemplate>
rderetrertet
</contentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel7" runat="server" HeaderText="Priljubljeni videi">
<contentTemplate>
dsfsfds gfrdgfdfgdfg gfd
</contentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</LoggedInTemplate>
<AnonymousTemplate>
<br />
<asp:Login ID="Login1" runat="server" PasswordRecoveryText="Pozabili geslo?">
</asp:Login>
</AnonymousTemplate>
</asp:LoginView>
</div>


</div>
 

thanks again for helping me with that..really appreciated.
0
Urko
5/4/2009 8:58:26 PM

How about trying this right now and see if you get some success:

In your code behind add this:

protected void AccessDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)

{

MembershipUser currentUser = Membership.GetUser();

Guid currentUserId = (Guid)currentUser.ProviderUserKey;

e.Command.Parameters["@UserId"].Value = currentUserId;

}

Modify your DetailsView like this:

<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px"

DataSourceID="AccessDataSource1" AutoGenerateRows="False"

DataKeyNames="UserId">

<Fields>

<asp:BoundField DataField="UserId" HeaderText="UserId" ReadOnly="True"

SortExpression="UserId" />

<asp:BoundField DataField="UserName" HeaderText="UserName"

SortExpression="UserName" />

<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />

<asp:BoundField DataField="PasswordQuestion" HeaderText="PasswordQuestion"

SortExpression="PasswordQuestion" />

<asp:BoundField DataField="PasswordAnswer" HeaderText="PasswordAnswer"

SortExpression="PasswordAnswer" />

<asp:CheckBoxField DataField="IsApproved" HeaderText="IsApproved"

SortExpression="IsApproved" />

<asp:BoundField DataField="CreateDate" HeaderText="CreateDate"

SortExpression="CreateDate" />

<asp:BoundField DataField="LastLoginDate" HeaderText="LastLoginDate"

SortExpression="LastLoginDate" />

<asp:BoundField DataField="Comment" HeaderText="Comment"

SortExpression="Comment" />

</Fields>

</asp:DetailsView>

And your AccessDataSource Something like this:

<asp:AccessDataSource ID="AccessDataSource1" runat="server"

onselecting="AccessDataSource1_Selecting" DataFile="~/App_Data/Orozje-Reloading-Center.mdb"

SelectCommand="SELECT aspnet_Membership.UserId, aspnet_Users.UserName, aspnet_Membership.Email, aspnet_Membership.PasswordQuestion, aspnet_Membership.PasswordAnswer, aspnet_Membership.IsApproved, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId WHERE (aspnet_Membership.UserId = @UserId)">

<SelectParameters>

<asp:ControlParameter ControlID="DetailsView1" Name="UserId"

PropertyName="SelectedValue" />

</SelectParameters>

</asp:AccessDataSource>


/GuruBhai
0
guru_sarkar
5/4/2009 11:49:54 PM

 hi,
thank you for the code...I placed it and i got thios error, line 16
 

Specified cast is not valid.

Line 14: MembershipUser currentUser = Membership.GetUser();
Line 15:
Line 16: Guid currentUserId = (Guid)currentUser.ProviderUserKey;
Line 17: e.Command.Parameters["@UserId"].Value = currentUserId;
Line 18:
 



0
Urko
5/5/2009 5:56:41 AM
Reply:

Similar Artilces:

Unable to cast object of type 'WIM2008_Web.App_Code.wim.security.data.User' to type 'WIM2008_Web.App_Code.wim.security.data.User'
I don't know if i post this in the rigth forum but it is related to database call. this is my code: public DataSet CustomerDetails_Select(Int32 ID)    {      DataSet ds = new DataSet();      WIMConnect wimcon = new WIMConnect();      WIMConnection cnnwim = new WIMConnection();      ConvertDataReaderToDataTable DrToDs = new ConvertDataReaderToDataTable();      GridViewHeadersDao gvh = new GridViewHeadersDao();       &nb...

Paypal and "Registered Users" (Cant edit Security settings for "Registered Users"
I would like to have people pay to be "Registered Users".On the "Edit Security Roles", "Advanced Settings", I can see "Service Fee", and similar settings.But I cant edit anything!The goal is to have PayPal payment on registration, and to have only one type of registered users...(Nor "Registered Users" and "Subscribers")ThanksOlav ...

Logged in user displays user specific data from database
Hi there - I am fairly new to ASP.NET and am hoping for some guidance here ... I am building an application for manages to track employees as the employee leaves the business.  Basically there are processes a line manager is required to complete and I want the manager to enter completion dates when those processes have been completed. I have gotten as far as successfully creating the login/membership controls.  The user (line manager) logs in and is then redirected to the correct page and thats fine.  However, I then want for the user to see records from a dat...

Cannot open user default database. Login failed. Login failed for user 'DOMAIN\User'. (.Net SqlClient Data Provider)
Hi when i try and open a database in sql server management studio i get the error "Cannot open user default database. Login failed. Login failed for user 'DOMAIN\User'. (.Net SqlClient Data Provider)", what can i do to rectify this, i have googled around and still havent found no answers. Which authentication mode is your Sql Server configured - MixedMode, Windows Authentication or Sql Server Authentication? Please refer to http://msdn2.microsoft.com/en-us/library/ms366351.aspx and http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx    Ple...

display data for a particular logged in user (User.Identity.Name;)
hi, basically i have a database table with: fileNo, fileName, fileSize, fileType, fileOwner etc at the minute my grid view displays ALL files for every fileOwner, how does one filter this to only displaying the files which belong to a particular fileOwner who is logged in.. i.e. SELECT * FROM tblFile       WHERE fileOwner = (User.Identity.Name)         -   to show files for a user who is logged in   how does one do this please?   thanks and regards Hi,jules U can Do like thisI am assuming that ur ...

How do I display data in a datagrid specific to the logged in user using the User ID
Hi, I've got a table that holds user details (such as age, location etc). This table is linked to a user logon details table by the UserID column. How do I get a datagrid to display the logged on users details?  Everything I've read so far uses Username but username isn't a column in my UserDetails table. I've tried SELECT all from the user details table and using UserID as a session parameter but the datagrid doesn't display so I'm doing something very wrong I think. The sql statement looks like this:  SELECT UserID, FirstName, Surname, Telephone, Sect...

same user control in two pages, display data from data base same time
I have two pages(.aspx), each of them havesame user control(.ascx) inside. that user control dispaly data from database. after I clickthe first page which displays data on the user control. I click the second page, I want to display same data already in the user control on the second page, thanks for any idea. sorry, i don't quite understand what you are trying to do. are you trying to say that the data should be cached for the usercontrol so it doesnt need to do constant trips to the database, if so: you should have a look at this : http://www.dotnetjunkies.com/quickstart/aspplus/doc/ca...

Creating User Account Without Default Security Role (Registered User Role)
  My DNN version is 3.1.1. The portal is set to Private Registration. Unauthenicated users have access to the basic pages of the site. We require my company's current customers to register and be approved to have access to all other pages that contain information restricted to them (the major part of the site). As you know, authorizing a user account applys the Registered User security role by default and this is how I control access to the customer areas.  We want to create a page that will be used by Marketing to allow potential customers by login to...

Disable register user page for registered users
i am working on my personal website using personal website site kit. every thing is working fine. but the register page or the option is available for registered users also which i dont want. i have very little knowledge of .net so may be this seems like a stupid problem, but please reply if u have a solution for this. thankyou. nasirmulani@gmail.comNasir Mulani If you wish to remove the Register menu item, you can edit the web.sitemap and either remove the line referencing the Register.aspx page, or comment it out.JeremyExtended Personal Site Starter kit Jeremy i am using ur pss kit ...

Login failed for user 'Bachelorplace'. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)
please tellme how to resolve this error, i m using server studio management tool. and trying to connect using sql server authentication. my pc is over a domain.   Login failed for user 'Bachelorplace'. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)  check whether that sql server is allowing sqlauthentication or not.select that server -> right click it-> select  properties  -> in the window, select security -> check what is the server authentication. it should be  sqlserver and windows authentica...

Display data for logged in User only
I try to figure out how to display data which belongs to one individual User only.Once the User logged in, he should see only the data which is related to his UserId. Currently I'm usingSELECT aspnet_Customers.FirstName, aspnet_Customers.LastName, aspnet_Customers.Address, aspnet_Customers.ZipCode, aspnet_Customers.City, aspnet_Customers.Country, aspnet_Customers.CustomerID, aspnet_Customers.UserID, aspnet_Membership.LoweredEmail, aspnet_Membership.LastLoginDate FROM aspnet_Customers INNER JOIN aspnet_Membership ON aspnet_Customers.UserID = aspnet_Membership.UserIdTwo Questions:1....

Display the user data in Textbox
I have a table in the database. It has three fields EmpId, EmpName, EmpSalary. In the Employee.aspx page, I have three lables and three textboxes. Once I login in to the system the corresponding details should be displayed in the textboxes. Please help me in this regard.                                                   Thanks. Add a where clause i...

Display data for logged in User only
I try to figure out how to display data which belongs to one individual User only.Once the User logged in, he should see only the data which is related to his UserId. Currently I'm usingSELECT aspnet_Customers.FirstName, aspnet_Customers.LastName, aspnet_Customers.Address, aspnet_Customers.ZipCode, aspnet_Customers.City, aspnet_Customers.Country, aspnet_Customers.CustomerID, aspnet_Customers.UserID, aspnet_Membership.LoweredEmail, aspnet_Membership.LastLoginDate FROM aspnet_Customers INNER JOIN aspnet_Membership ON aspnet_Customers.UserID = aspnet_Membership.UserIdI know there is somethi...

Display Data by User Group
I have a page that currently displays a list of data pulled from our SQL server. The server has select, insert, update and delete permissions for one Security Group, and just Select for another. The problem I have is that right now, all the users still see the "Add" page, as well as the Update and Delete links on the grid.  What I don't know how to do is hide links, etc... for a user who belongs to a certain security group. Any insight on this would be great! The ASP pages are using Windows Authenitcation, and passing the individual user's credentials back to the server.  A...

Web resources about - displaying user data after they register - asp.net.security

List of mammals displaying homosexual behavior - Wikipedia, the free encyclopedia
For these mammals, there is documented evidence of homosexual behavior of one or more of the following kinds: sexual behavior , courtship , affection ...

Facebook Displaying Page Insights On Page Admins’ Personal Pages?
Some Facebook page administrators are seeing modules on their personal pages displaying page insights ad, campaign , and like totals for pages ...

Facebook Displaying Unread Messages from Pages in a New Updates Module
Facebook is displaying a new “Updates” sidebar module which shows some users unread messages sent to them by Pages. Users will see the Updates ...

Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air CNN Live - YouTube
Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air Lemon held up a Confederate flag first before holding up the sign. He asked, ...

Hazelwood coal mine fire: Morwell residents displaying symptoms similar to cigarette smokers, expert ...
An expert says some locals near Victoria's Hazelwood mine fire have symptoms similar to cigarette smokers.

Police accused of displaying fake G20 weapons
Toronto's top police officer misled the public by displaying fake weapons used in a medieval-themed role-playing game to help justify their actions ...

No charges for U.S. host for displaying high-capacity magazine on TV
NBC television journalist David Gregory won't face charges for displaying a high-capacity ammunition magazine on his "Meet the Press" news program ...

Jays' Escobar suspended three games for displaying slur
Toronto Blue Jays shortstop Yunel Escobar has been suspended three games for displaying a homophobic slur on his eye-black during a game on Saturday. ...

Google Play Store now displaying age-based ratings
We reported back in May that Google was adding age-based ratings to all apps in the Play Store as determined by the International Age Rating ...

Apple displaying Ferraris & other cars at WWDC hinting at CarPlay announcements
... 2014 Filed under: AAPL Company , iOS Continue reading more about AAPL Company and iOS at 9to5Mac . What do you think? Discuss "Apple displaying ...

Resources last updated: 11/24/2015 11:37:50 PM