Saturday, March 31, 2012

Setting MembershipUser.IsApproved, how?

ASP.NET 2.0

The code below doesn't set IsApproved to true. I mean that I've debugged
this code and usr.IsApproved actually get set to true. But when I quit the
application and in VS2005 I start "ASP.NET Configuration" then I still see
the user without the "active" column checked. To me it looks like
usr.IsApproved isn't saved back to the database, I thought the
MembershipUser automatically would do this?? What am I doing wrong here?

if (Request.QueryString["user"] != null)
{
string username = Request.QueryString["user"].ToString();
if (username.Length 0)
{
MembershipUser usr = Membership.GetUser(username);
usr.IsApproved = true;
}
}

JeffHey

I used Membership.UpdateUser(usr); to save the updated MembershipUser

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:uyCjUBLdHHA.4624@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

ASP.NET 2.0
>
The code below doesn't set IsApproved to true. I mean that I've debugged
this code and usr.IsApproved actually get set to true. But when I quit the
application and in VS2005 I start "ASP.NET Configuration" then I still see
the user without the "active" column checked. To me it looks like
usr.IsApproved isn't saved back to the database, I thought the
MembershipUser automatically would do this?? What am I doing wrong here?
>
if (Request.QueryString["user"] != null)
{
string username = Request.QueryString["user"].ToString();
if (username.Length 0)
{
MembershipUser usr = Membership.GetUser(username);
usr.IsApproved = true;
}
}
>
Jeff
>


Membership.UpdateUser(userObj) should have updated the user status.
Check to see if you are not over-riding the save anywhere else.

Just as a test, try to check the user-details after you set the IsApproved
to true.
Write it to the UI. And also check the db-call in your profiler to see if
its being passed the back-end.

The ASP.NET configuration mmc, i am not sure..i don't use it.

--
Sashidhar Kokku
ikaSystems Corp

"Jeff" wrote:

Quote:

Originally Posted by

Hey
>
I used Membership.UpdateUser(usr); to save the updated MembershipUser
>
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:uyCjUBLdHHA.4624@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

ASP.NET 2.0

The code below doesn't set IsApproved to true. I mean that I've debugged
this code and usr.IsApproved actually get set to true. But when I quit the
application and in VS2005 I start "ASP.NET Configuration" then I still see
the user without the "active" column checked. To me it looks like
usr.IsApproved isn't saved back to the database, I thought the
MembershipUser automatically would do this?? What am I doing wrong here?

if (Request.QueryString["user"] != null)
{
string username = Request.QueryString["user"].ToString();
if (username.Length 0)
{
MembershipUser usr = Membership.GetUser(username);
usr.IsApproved = true;
}
}

Jeff


>
>
>

0 comments:

Post a Comment