Click here to Skip to main content
15,889,281 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionloading user info after login from object Pin
liamderice12-Mar-09 9:37
liamderice12-Mar-09 9:37 
hey there, I'm still learning C# and am having some issues with a login I've created. The login page gets the user info into an object and sets the cookie no problem. But when I go to the next page I can't seem to figure out how to get at the object I created on the login page. Here's a snippet of what I've got...

login.aspx.cs
private void cmdLogin_ServerClick(object sender, System.EventArgs e)
{
  UserDetails oUserDetails = validateUser(txtAssocNum.Value, txtUserName.Value, txtUserPass.Value);
  if (oUserDetails != null) 
  {
    //UserDetails oUserDetails = new UserDetails();
    
    Response.Cookies["UserID"].Path = "/";
    Response.Cookies["UserID"].Value = oUserDetails.UserID.ToString();
    FormsAuthentication.RedirectFromLoginPage(txtUserName.Value, chkPersistCookie.Checked);

    //oUserDetails = null;
  } 
  else {
    lblMsg.Text = "The information you provided does not match our database.";
  }
}




loadDetailsAfterLogin.aspx.cs
protected System.Web.UI.WebControls.Panel PanelMain;

private void Page_Load(object sender, System.EventArgs e)
{
  Response.Cache.SetCacheability(HttpCacheability.NoCache);

  if (!User.Identity.IsAuthenticated) 
  {
    Response.Redirect("~/Login.aspx");
  }

  UserDetails oUserDetails = new UserDetails();
  //UserDetails oUserDetails = UserDetails();

  PanelMain.Controls.Add(new LiteralControl("<table>"));
  PanelMain.Controls.Add(new LiteralControl("<tr><td>First Name : </td><td>" + oUserDetails.FirstName + "</td></tr>"));
  PanelMain.Controls.Add(new LiteralControl("<tr><td>Last Name : </td><td>" + oUserDetails.LastName + "</td></tr>"));
  PanelMain.Controls.Add(new LiteralControl("</table>"));

  oUserDetails = null;
}


Thanks in advance.
AnswerRe: loading user info after login from object Pin
Christian Graus12-Mar-09 10:04
protectorChristian Graus12-Mar-09 10:04 
GeneralRe: loading user info after login from object Pin
liamderice12-Mar-09 10:31
liamderice12-Mar-09 10:31 
GeneralRe: loading user info after login from object Pin
Jörgen Andersson12-Mar-09 12:11
professionalJörgen Andersson12-Mar-09 12:11 
GeneralRe: loading user info after login from object Pin
Christian Graus12-Mar-09 12:20
protectorChristian Graus12-Mar-09 12:20 
GeneralRe: loading user info after login from object Pin
liamderice13-Mar-09 3:42
liamderice13-Mar-09 3:42 
Questionin excel how to use mailmerge Pin
sivapran12-Mar-09 9:24
sivapran12-Mar-09 9:24 
QuestionRefresh of a seperate gridview in an ASP.NET page. Pin
shawty_ds12-Mar-09 6:53
shawty_ds12-Mar-09 6:53 
AnswerRe: Refresh of a seperate gridview in an ASP.NET page. Pin
Christian Graus12-Mar-09 9:35
protectorChristian Graus12-Mar-09 9:35 
GeneralRe: Refresh of a seperate gridview in an ASP.NET page. Pin
shawty_ds12-Mar-09 12:57
shawty_ds12-Mar-09 12:57 
GeneralRe: Refresh of a seperate gridview in an ASP.NET page. Pin
shawty_ds12-Mar-09 13:06
shawty_ds12-Mar-09 13:06 
Questionbyte[] to string Pin
M.Ambigai12-Mar-09 6:43
M.Ambigai12-Mar-09 6:43 
AnswerRe: byte[] to string Pin
shawty_ds12-Mar-09 6:57
shawty_ds12-Mar-09 6:57 
GeneralRe: byte[] to string Pin
M.Ambigai12-Mar-09 7:53
M.Ambigai12-Mar-09 7:53 
GeneralRe: byte[] to string Pin
shawty_ds12-Mar-09 8:53
shawty_ds12-Mar-09 8:53 
GeneralRe: byte[] to string Pin
M.Ambigai12-Mar-09 15:54
M.Ambigai12-Mar-09 15:54 
GeneralRe: byte[] to string Pin
shawty_ds13-Mar-09 5:35
shawty_ds13-Mar-09 5:35 
AnswerRe: byte[] to string Pin
Yusuf12-Mar-09 8:53
Yusuf12-Mar-09 8:53 
QuestionCould not able to open asp.net website application Pin
nuthan anand12-Mar-09 6:14
nuthan anand12-Mar-09 6:14 
AnswerRe: Could not able to open asp.net website application Pin
Abhijit Jana12-Mar-09 6:21
professionalAbhijit Jana12-Mar-09 6:21 
AnswerRe: Could not able to open asp.net website application Pin
johnsontroye12-Mar-09 13:47
johnsontroye12-Mar-09 13:47 
Questionadapter update using stored procedure Pin
member2712-Mar-09 5:19
member2712-Mar-09 5:19 
AnswerRe: adapter update using stored procedure Pin
fred_12-Mar-09 7:54
fred_12-Mar-09 7:54 
QuestionWebsite not working with Oracle 10g and IIS 7 Pin
Khaldris12-Mar-09 4:45
Khaldris12-Mar-09 4:45 
AnswerRe: Website not working with Oracle 10g and IIS 7 Pin
Abhijit Jana12-Mar-09 5:04
professionalAbhijit Jana12-Mar-09 5:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.