Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2010, 03:26 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default ASP.net Login Name Control

Hi,
I am working on with a web site. That allow users to log in.After they logged in, they are redirected to a new page where i have attached a login name control to show there login status.In that new page i have my own custom data which allows users to enter some information that will be stored in my custom database.
Along with the other informtion i also want the LOGIN NAME control to store the content ie the User's name, to my custom database. But i could not extract the content from the Login name Control.
I also tried
Login name1.Format String to store in my database. But it stored {0 } and not the exact logged in username.
Can you please help me how to extact the user name from Login name Control.
-Thanks Gayathri79
 
Old March 1st, 2010, 03:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You can capture the user name with the following code:

User.Identity.Name

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 1st, 2010, 03:57 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Oh Thanks a lot. It Worked.

One more Question. I want to set Validation for User name as Unique in Create User Wizard. Is there a property for that?

-Gayathri79
 
Old March 1st, 2010, 04:06 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

They are already unique by design (per application, that is).

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 1st, 2010, 07:01 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default Display Create User Wizard information.

I tried to display the Create User Wizard Information which user entered when signing up. But i could do that only with the Data Bound controls like Details view and Grid view.

Can i extract the membership information and display in text box control for editing? How can i do that? Please help.

Thanks
-Gayathi79
 
Old March 1st, 2010, 07:09 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at my reply in the other thread. Membersjip.GetUser() gives you a reference to the current user.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
asp.net login error akshay144 ASP.NET 3.5 Basics 1 August 3rd, 2009 08:18 PM
asp.net login control kulkarnimonica ASP.NET 2.0 Professional 6 September 25th, 2007 05:22 PM
ASp.net 2.0 login name control kulkarnimonica ASP.NET 2.0 Professional 12 July 11th, 2007 12:42 AM
login control problem (asp.net2.0 website progr..) rookie07 ASP.NET 2.0 Basics 1 June 22nd, 2006 09:25 AM
ASP.NET Login Control Question adnanjamil ASP.NET 2.0 Professional 1 April 30th, 2006 07:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.