473,725 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1919
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_It emUpdating(ByVa l sender As Object, ByVal e as
DetailsViewUpda teEventArgs)
'Need to handle the update manually because MembershipUser does
not have a
'parameterless constructor
Dim memUser as MembershipUser = Membership.GetU ser()

memUser.Email = CStr(e.NewValue s(0))
memUser.Comment = CStr(e.NewValue s(1))

Try
Membership.Upda teUser(memUser)

e.Cancel = true
DetailsView1.Ch angeMode(Detail sViewMode.ReadO nly)
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.IsLock edOut = 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_Membersh ip_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_Membersh ip_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
9864
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
1451
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 (I have several pages that will require online submission) I'm not getting any emails and I'm not even getting the confirmation page that I defined....ANY HELP WOULD BE GREAT.... Thanks in advance
2
1494
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 well otherwise I cannot enter payments. I have never done anything like this and wondered if someone could help. Lucy
1
1315
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 last record from the linked membership details subform in a field on the member form.I am trying to use this to maintain a membership history;Would it be possible to return this value for the current membership year and possibly return "Non Financial...
3
1329
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 think it's an hassle for certain tasks...here's my problem : I have created some users and successfully log them with the supplied
0
1823
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, Mozilla has been confirmed as a keynote for XTech 2006. His presentation, "JavaScript 2 and the Future of the Web", takes place on Friday afternoon, 19 May. Alex Russell is now confirmed to open the AJAX Developers' Day. For full XTech program...
2
4172
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 the table, BUT cannot do an UPDATE. After the update command it says 1 row updated, but the data does not change. At one point I receieved a message stating something like (heavily paraphrased...):
3
2229
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 value is displayed. Anyone any idea? Dim user As MembershipUser Dim bruker as string
2
1783
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
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.