m develoing a site whereby employees are supposed to log in and take orders. the users are being created thru the ASP web Administration tool and stored by default into the SQL Server Database named AspNetDB.mdf that's stored in the App_Data folder of our website. the database is created auomatically. How to display the userid as this userid is too complicated and there can be many users with the same username.
You can use the Membership class to get the info about a user:
The GetUser method can also take a username as argument if you need to get a specific user, if you don't pass a username, the current logged in user will be returned. The GetUser method returns a MembershopUser class which have a UserName property and a ProdiverUserKey which will return the id of the user.
/Fredrik Normén - fredrikn @ twitter
Microsoft MVP, MCSD, MCAD, MCT
m grateful that u replied. but sorry, m not clear wit wat u said. Actually, m very new to asp.net. wat m trying is to display the username with the unique id and store the order details for that username and again retrieve it later from the DB. And also filter the orders based on this username but not on the userid as this userid's are stored in a complex format. i want to display and store the username along wit the id at the click of a button which will also store the order details into the DB. plz help me out wit the details of implementing this solution. thanx!
Please see the methods, they are under the MemberShip:
<img src="http://forums.asp.net/msdn/Controls/CollapsibleArea/en-us/minus.gif" class="CollapseRegionImg" id="ctl00_LibFrame_ctl22img" alt="Public Methods" align="middle">Public Methods
|CreateUser||Overloaded. Adds a new user to the data store.|
|DeleteUser||Overloaded. Deletes a user from the database.|
|Equals||Overloaded. Determines whether two Object instances are equal. (inherited from Object)|
|FindUsersByEmail||Overloaded. Gets a collection of membership users where the e-mail address contains the specified e-mail address to match.|
|FindUsersByName||Overloaded. Gets a collection of membership users where the user name contains the specified user name to match.|
|GeneratePassword||Generates a random password of the specified length.|
|GetAllUsers||Overloaded. Gets a collection of the users in the database.|
|GetHashCode||Serves as a hash function for a particular type. (inherited from Object)|
|GetNumberOfUsersOnline||Gets the number of users currently accessing an application.|
|GetType||Gets the Type of the current instance. (inherited from Object)|
|GetUser||Overloaded. Gets the information for a membership user from the data source.|
|GetUserNameByEmail||Gets a user name where the e-mail address for the user matches the specified e-mail address.|
|ReferenceEquals||Determines whether the specified Object instances are the same instance. (inherited from Object)|
|ToString||Returns a String that represents the current Object. (inherited from Object)|
|UpdateUser||Updates the database with the information for the specified user.|
|ValidateUser||Verifies that the supplied user name and password are valid.|
and here is the link: http://msdn2.microsoft.com/en-us/library/system.web.security.membership_members.aspx
Please correct me if I have misunderstood your mean, please LET ME KNOW, Thanks,
Hope it helps,
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.