我用profile做购物车,首先我登陆通过 string username = txtUserName.Text;
string pwd = txtPwd.Text;
if (Membership.ValidateUser(username, pwd))
{
MembershipUserCollection user= Membership.FindUsersByName(username);
Response.Redirect("~/trade/Default.aspx");
}
else {
Response.Redirect("Default2.aspx");
}
但是我要活的用户的ID应该要怎么获得啊,用FindUsersByName不可以获得ID,哪位高手帮忙啊!
string pwd = txtPwd.Text;
if (Membership.ValidateUser(username, pwd))
{
MembershipUserCollection user= Membership.FindUsersByName(username);
Response.Redirect("~/trade/Default.aspx");
}
else {
Response.Redirect("Default2.aspx");
}
但是我要活的用户的ID应该要怎么获得啊,用FindUsersByName不可以获得ID,哪位高手帮忙啊!
{
txtName.Text = Profile.name;
}
MembershipUserCollection users = Membership.GetAllUsers();
foreach (MembershipUser singleUser in Users)
{
ProfileCommon userprofile = Profile.GetProfile(singleUser.UserName);
Response.Write(userprofile.name);
}
void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs args)
{
//取得匿名用户的ID
ProfileCommon anonyProfile = Profile.GetProfile(args.AnonymousID);
if ((anonyProfile.color.backcolor != null) && (anonyProfile.color.forecolor != null))
{}}
是否是配置问题
tring username = txtUserName.Text;
string pwd = txtPwd.Text;
if (Membership.ValidateUser(username, pwd))
{
MembershipUserCollection user= Membership.FindUsersByName(username);
Session["User"] = user; //登陆信息存放到Session里,其他页面可以使用读取(MembershipUserCollection)Session["User"]来读取
Response.Redirect("~/trade/Default.aspx");
}
else {
Response.Redirect("Default2.aspx");
}
string pwd = txtPwd.Text;
if (Membership.ValidateUser(username, pwd))
{
MembershipUserCollection user= Membership.FindUsersByName(username);
Session["User"] = user; //登陆信息存放到Session里,其他页面可以使用读取(MembershipUserCollection)Session["User"]来读取
Response.Redirect("~/trade/Default.aspx");
}
else {
Response.Redirect("Default2.aspx");
}
我也喜歡用SESSION.