J
Jeff
Hey
asp.net 3.5
I'm trying to develop a asp.net site which when user registers his profile
is not activated. He will receive a email containing a link he need to click
on to activate his profile
The problem is that when user click on the link, the code behind the link
don't find the user.
Here is some code:
protected void SendingMail(object sender, MailMessageEventArgs e)
{
CreateUserWizard cuw = (CreateUserWizard)sender;
MembershipUser user = Membership.GetUser(cuw.UserName);
Guid userId = (Guid)user.ProviderUserKey;
e.Message.Body = e.Message.Body.Replace("<%PasswordQuestion%>",
CreateUserWizard1.Question);
e.Message.Body = e.Message.Body.Replace("<%PasswordAnswer%>",
CreateUserWizard1.Answer);
e.Message.Body = e.Message.Body.Replace("<%link%>",
userId.ToString()); // Confirm.aspx?id=<%link%>
}
protected void Page_Load(object sender, EventArgs e)
{
if (Request["id"] != null)
{
string d = Request["id"];
MembershipUser user = Membership.GetUser(Request["id"]);
if (user != null && user.IsApproved == false)
{
user.IsApproved = true;
Membership.UpdateUser(user);
}
}
}
The problem is with this line "MembershipUser user =
Membership.GetUser(Request["id"]);". The user object is still a NULL value,
so the if-block isn't run.
I use Form authentication
Any suggestions?
asp.net 3.5
I'm trying to develop a asp.net site which when user registers his profile
is not activated. He will receive a email containing a link he need to click
on to activate his profile
The problem is that when user click on the link, the code behind the link
don't find the user.
Here is some code:
protected void SendingMail(object sender, MailMessageEventArgs e)
{
CreateUserWizard cuw = (CreateUserWizard)sender;
MembershipUser user = Membership.GetUser(cuw.UserName);
Guid userId = (Guid)user.ProviderUserKey;
e.Message.Body = e.Message.Body.Replace("<%PasswordQuestion%>",
CreateUserWizard1.Question);
e.Message.Body = e.Message.Body.Replace("<%PasswordAnswer%>",
CreateUserWizard1.Answer);
e.Message.Body = e.Message.Body.Replace("<%link%>",
userId.ToString()); // Confirm.aspx?id=<%link%>
}
protected void Page_Load(object sender, EventArgs e)
{
if (Request["id"] != null)
{
string d = Request["id"];
MembershipUser user = Membership.GetUser(Request["id"]);
if (user != null && user.IsApproved == false)
{
user.IsApproved = true;
Membership.UpdateUser(user);
}
}
}
The problem is with this line "MembershipUser user =
Membership.GetUser(Request["id"]);". The user object is still a NULL value,
so the if-block isn't run.
I use Form authentication
Any suggestions?