473,406 Members | 2,217 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,406 software developers and data experts.

update more than only the email with asp.net membership

Hi all,

I am currently developing in asp.net 2.0 and I was at first impressed
with the numerous login and user controls they provided to ease the
task of managing users.

But I am starting to think it's an hassle for certain tasks...here's my
problem :

I have created some users and successfully log them with the supplied
controls. However, I have hard times with the 'user managment' screen
(for the admin). On one page, I list all the users available in a
Gridview. Up to there, everything works, great. However, I need to
update the users information and I've tried the method suggested here
(http://asp.net/QuickStart/util/srcvi...ty/Update.src),
adapted to a gridview (with the RowUpdating event).

But with the given method, I can only update the email!! what the
&*$%......I can't change the Username nor the IsLockedOut values,
because they are 'ReadOnly' properties. What does that mean? That I
can't change them at all? How is the admin going to disable any users?

I'd appreciate if someone can point me some resource that explain how
to update user properties like username or locked status. This
membership system is getting me mad.

Thanks! :)

ibiza

Mar 2 '06 #1
3 1907
Hello ibiza,

I'm not sure exactly what the problem is with your code but I noticed in the
source from the Quickstart, that many of the bound items are marked as
ReadOnly. If you change that property, then you should be able to change
those fields (you probably already know this). My understanding is that if
you go with the default membership data schema, everything is keyed off the
username (an aspect that I disagree with. I feel that everything should be
keyed off the email. But that's another story). I would assume that means you
probably don't want to be mucking around with the username (they should
probably be unique) and that's why they made the quickstart tutorial the way
they did.

--
brians
http://www.limbertech.com
"ibiza" wrote:
Hi all,

I am currently developing in asp.net 2.0 and I was at first impressed
with the numerous login and user controls they provided to ease the
task of managing users.

But I am starting to think it's an hassle for certain tasks...here's my
problem :

I have created some users and successfully log them with the supplied
controls. However, I have hard times with the 'user managment' screen
(for the admin). On one page, I list all the users available in a
Gridview. Up to there, everything works, great. However, I need to
update the users information and I've tried the method suggested here
(http://asp.net/QuickStart/util/srcvi...ty/Update.src),
adapted to a gridview (with the RowUpdating event).

But with the given method, I can only update the email!! what the
&*$%......I can't change the Username nor the IsLockedOut values,
because they are 'ReadOnly' properties. What does that mean? That I
can't change them at all? How is the admin going to disable any users?

I'd appreciate if someone can point me some resource that explain how
to update user properties like username or locked status. This
membership system is getting me mad.

Thanks! :)

ibiza

Mar 2 '06 #2
Hi brians, thank you very much for your reply.

They made the bound items read only so the user cannot change them.
However, being able to change them does not mean being able to update
them. The real update is done here :

Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e as
DetailsViewUpdateEventArgs)
'Need to handle the update manually because MembershipUser does
not have a
'parameterless constructor
Dim memUser as MembershipUser = Membership.GetUser()

memUser.Email = CStr(e.NewValues(0))
memUser.Comment = CStr(e.NewValues(1))

Try
Membership.UpdateUser(memUser)

e.Cancel = true
DetailsView1.ChangeMode(DetailsViewMode.ReadOnly)
Catch ex as Exception
Response.Write("<div>The following error occurred:<font
color='red'> " + ex.Message + "</font></div>")

e.Cancel = true
End Try
End Sub

The fact is, if you add for example :

"memUser.IsLockedOut = True", it would throw an exception, as the
property IsLockedOut from MembershipUser is read-only. So they only
made the bound controls readonly because even if the user had the
chance to change the data in textboxes, it could not be updated
programatically because the MembershipUser object would not allow it.

I can live, if I have to, with not being able to change the username,
but gosh, I really need to lock/unlock users.

Mar 2 '06 #3
Hi ibiza,

Just from a quick glance at the stored procedure
aspnet_Membership_UpdateUser would lead me to believe that you don't want to
be unlocking the user with the UpdateUser() method. But there is an
aspnet_Membership_UnlockUser stored procedure which I would assume resolves
to the MembershipUser.UnlockUser() method. You can probably use it to unlock
the user.

--
brians
http://www.limbertech.com

Mar 2 '06 #4

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

Similar topics

114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
1
by: dmiller23462 | last post by:
Does anyone see anything OUTRIGHT that I can fix on this....I'm a virgin ASP'er and I'm trying to produce an email from a form submission button....This is just my little "template" for future use...
2
by: lulupuce | last post by:
Hi! I have a problem with a small app. I have a membership table and a payment table, they work ok together but when I create a new member I want the app to create a new record in the payments as...
1
by: Trevor | last post by:
Hi AllI have a membership database that has a member form with a membership details subform on it. The sub form has Date & Membership Level fieldsI need to display the Membership Level from the...
3
by: ibiza | last post by:
Hi all, I am currently developing in asp.net 2.0 and I was at first impressed with the numerous login and user controls they provided to ease the task of managing users. But I am starting to...
0
by: melledge | last post by:
XTech 2006 Updates -Keynote Update - Barcamp Amsterdam II XTech 2006 - 16-19 May - Hotel Grand Krasnapolsky - Amsterdam, The Netherlands Mozilla keynote added to agenda - Brendan Eich, CTO,...
2
by: TJ | last post by:
Hi All, I am having some trouble. I have created a database via the new database option inside VWD2005. Then and table or two. I have been able to perform INSERT and SELECT operations on...
3
by: Linn | last post by:
Hi, I am trying to update the e-mail for å user (as an admin), but the new e-mail address is not saved. The msgbox gives met he correct email, but when I reload my data in the gridview, the old...
2
by: Andy B | last post by:
I have a database with asp.net membership inside it. How would I use it for 2 or more web applications at the same time?
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.