yay my first post. yes Laura, that is the link that will be sent to the user. userId.ToString() will be replaced by the ProviderUserKey value that is stored in your membership provider database.
I tried your code out Peaks, works great, excep I had to change
string userId = Request.QueryString("userId");
to
string userId = Request.QueryString.Get("userId");
I also added response.writes to let the user know the status of their activation.
protected void Page_Load(object sender, EventArgs e)
{
string userId = Request.QueryString.Get("userId");
Guid oGuid = new Guid(userId.ToString());
//get the user so that we can approve the account.
MembershipUser oUser = Membership.GetUser(oGuid);
if (!((oUser == null)) && oUser.IsApproved == false)
{
oUser.IsApproved = true;
Membership.UpdateUser(oUser);
//below code navigates to a url requested beforehand
//System.Web.Security.FormsAuthentication.RedirectFromLoginPage(oUser.UserName, false);
//write a success message to the screen
Response.Write("You have successfully activated your account.");
}
else Response.Write("Your account has already been activated.");
}
It'd probably be a good idea to say that the IsLockedOut property is what you should use to lock accounts, not the IsApproved property, since users can always use the link that you generate to reapprove their accounts if it is manually unapproved by you.