Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir,
C#
public partial class PagesUser_WelcomeUser : System.Web.UI.Page
{
    string name;
    string mail;
    SqlConnection conn = new SqlConnection(@"Data Source=.\sqlexpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\OnlineLibrary.mdf;Integrated Security=True");
    protected void Page_Load(object sender, EventArgs e)
    {
        name = Page.User.Identity.Name;
        //SqlDataAdapter adpmail = new SqlDataAdapter("select UserName,Email from aspnet_Membership M join aspnet_Users U on M.UserId=U.UserId where U.UserName='" + name + "'", conn);

        //DataSet dsmail = new DataSet();
        //adpmail.Fill(dsmail, "Library_user");
        //mail = dsmail.Tables[0].Rows[0]["Email"].ToString();
        //txtMail.Text = mail;

    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        pnlForm.Visible = false;
        btnsubmit.Visible = false;

        try
        {
            conn.Open();
            SqlCommand insert = new SqlCommand("Insert Library_User values('" + name + "','" + txtName.Text + "', " + txtAge.Text + ",'" + txtDesignation.Text + "','" + txtMail.Text + "','" + txtPhone.Text + "','" + txtAddress.Text + "','" + txtDD.Text + "')", conn);
            int insertRecord = insert.ExecuteNonQuery();
            if (insertRecord >= 1)
            {
                lblMsg.Text = "congradulation...your details have been registered";
                
            }
            else
            {
                lblMsg.Text = "Records not entered. Try again..!!!";
                lblMsg.Visible = true;

            }
            conn.Close();


        }
        catch
        {
            lblMsg.Text = "Your Records have been already entered. Please proceed...";
            lblMsg.Visible = true;
        }

i am creating user registeration page and after sucessfully registeration complete profile where user put his all information.i try take email id from userregisteration page itself line:name = Page.User.Identity.Name;
but it takes name as my server name by default its should take name from aspnet_db
kindly help
Posted
Updated 23-Dec-12 5:52am
v2
Comments
[no name] 23-Dec-12 11:25am    
1. Format your code.
2. there is not similarity with your title and problem.
3. Whats your problem, explain details.

Thanks.
deeptul 28-Dec-12 2:12am    
dear sir,
i do authetcation of user after that userauthentication name should be come under page
name=Page.User.Identity.Name;//this is complete profile page
but name it will not take the username instead it takes my server name.
kindly help me how to take username in afterauthentication

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900