pass values or data from one page to another when you use Login control in ASP.NET 2.0

后端 未结 4 1574
盖世英雄少女心
盖世英雄少女心 2021-01-26 01:12

I am using Login Control available in ASP.NET 2.0 in the login page. Once the user is authenticated successfully against database, I am redirecting the user to home.aspx. Here,

4条回答
  •  旧巷少年郎
    2021-01-26 01:57

    If you are using standard asp.net authentication then you should be able to access the users name through the User property of the page object.

    User.Identity.Name

    As Andrew suggested, Session is a common place to place a user name, though I avoid using session at all if possible.

    You could set a cookie with the users name.

    You could also set the DestinationPageUrl property of the login control to include the username in the query string. Though that feels/looks pretty lame.

提交回复
热议问题