有问题请教大家,在login之后转到用户的个人信息页面,但如何在登陆以后的页面是注册用户的身份呢?
我用的是VB,现在在看一个C#的程序,但有点看不懂,
override protected void OnInit(EventArgs e)
{
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{    
this.Submit.Click += new System.EventHandler(this.Submit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Submit_Click(object sender, System.EventArgs e)
{
string userName = LoginName.Text.Trim();
string password = Password.Text.Trim();
string question = Question.Text.Trim();
string answer = Answer.Text.Trim();
BLL.ShoppingCart cart = new eshop.BLL.ShoppingCart();
string tempCartId = cart.GetShoppingCartId();
//试图添加新用户
BLL.User user = new eshop.BLL.User();
int userId = user.AddNewUser(userName, password, question, answer);
//如果返回值为-1,则表示用户名存在
if (userId == -1)
{
Message.Text = "用户名已存在!";
}
else
{
//设置用户为通过验证
System.Web.Security.FormsAuthentication.SetAuthCookie(userId.ToString(),false);
cart.MigrateCart(tempCartId, userId.ToString());
//将用户重定向回用户帐户页面
Response.Redirect("MyAcount.aspx");
}以下是regesit之后转入myaccount页面,里面并没有我想要的内容啊public class MyAcount : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// </summary>
private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
谢谢各位高手指导了

解决方案 »

  1.   

    你这是注册新用户??那就返回新注册用户的ID号,在个人页面(用户管理页面)根据用户ID显示信息不就好了。
    如果你的用户名是唯一的,那也可以在注册成功后保存用户名,再根据用户名显示信息。
      

  2.   

    用户登录的时候把用户的ID加到Session里面啊,然后转到用户信息页面的时候再把Session里面的用户ID取出来,根据ID从数据库提取对应的用户信息数据。