Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

User name is blank in Login Page

subhasamsubhasam Posts: 11Member
Hi all,

Iam using form authentication in my web app. After user login i want to redirect depends on user info.
My problem is :

User.Identity.name is blank in login page but its working fine in other page.

Forms Authentication in web.config file



private

void btnlogin_Click(object sender, System.EventArgs e)
{ if(checking User credentials)


{ Id=somevalue;
FormsAuthentication.SetAuthCookie(Id.ToString(),false);

Response.Write(User.Identity.Name.ToString());

//Response.Write(Context.User.Identity.Name.ToString());

}
}

Thanks in advance

Comments

  • iwilld0itiwilld0it Posts: 1,134Member
    Well believe in this code ID.ToString() is going to be the eventual value of User.Context.Name, so can at that point redirect based on ID.ToString

    : Hi all,
    :
    : Iam using form authentication in my web app. After user login i want to redirect depends on user info.
    : My problem is :
    :
    : User.Identity.name is blank in login page but its working fine in other page.
    :
    : Forms Authentication in web.config file
    :
    :
    :
    : private
    :
    : void btnlogin_Click(object sender, System.EventArgs e)
    : { if(checking User credentials)
    :
    :
    : { Id=somevalue;
    : FormsAuthentication.SetAuthCookie(Id.ToString(),false);
    :
    : Response.Write(User.Identity.Name.ToString());
    :
    : //Response.Write(Context.User.Identity.Name.ToString());
    :
    : }
    : }
    :
    : Thanks in advance
    :

  • subhasamsubhasam Posts: 11Member
    Hi ,

    Thanks . But whether its possible to use User.Identity.... in Login Page?
    I no in Asp.net 2.0 U can do it with membership..
    Iam using asp.net 1.1 , so i want to no in that...



    : Well believe in this code ID.ToString() is going to be the eventual value of User.Context.Name, so can at that point redirect based on ID.ToString
    :
    : : Hi all,
    : :
    : : Iam using form authentication in my web app. After user login i want to redirect depends on user info.
    : : My problem is :
    : :
    : : User.Identity.name is blank in login page but its working fine in other page.
    : :
    : : Forms Authentication in web.config file
    : :
    : :
    : :
    : : private
    : :
    : : void btnlogin_Click(object sender, System.EventArgs e)
    : : { if(checking User credentials)
    : :
    : :
    : : { Id=somevalue;
    : : FormsAuthentication.SetAuthCookie(Id.ToString(),false);
    : :
    : : Response.Write(User.Identity.Name.ToString());
    : :
    : : //Response.Write(Context.User.Identity.Name.ToString());
    : :
    : : }
    : : }
    : :
    : : Thanks in advance
    : :
    :
    :

  • sapnasapna Posts: 3Member
    Hi ,

    I want ome ecurity in asp.

    In which i want any asp page could't open directly






    : Hi ,
    :
    : Thanks . But whether its possible to use User.Identity.... in Login Page?
    : I no in Asp.net 2.0 U can do it with membership..
    : Iam using asp.net 1.1 , so i want to no in that...
    :
    :
    :
    : : Well believe in this code ID.ToString() is going to be the eventual value of User.Context.Name, so can at that point redirect based on ID.ToString
    : :
    : : : Hi all,
    : : :
    : : : Iam using form authentication in my web app. After user login i want to redirect depends on user info.
    : : : My problem is :
    : : :
    : : : User.Identity.name is blank in login page but its working fine in other page.
    : : :
    : : : Forms Authentication in web.config file
    : : :
    : : :
    : : :
    : : : private
    : : :
    : : : void btnlogin_Click(object sender, System.EventArgs e)
    : : : { if(checking User credentials)
    : : :
    : : :
    : : : { Id=somevalue;
    : : : FormsAuthentication.SetAuthCookie(Id.ToString(),false);
    : : :
    : : : Response.Write(User.Identity.Name.ToString());
    : : :
    : : : //Response.Write(Context.User.Identity.Name.ToString());
    : : :
    : : : }
    : : : }
    : : :
    : : : Thanks in advance
    : : :
    : :
    : :
    :
    :

Sign In or Register to comment.