Click here to Skip to main content
13,088,136 members (73,981 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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;
            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";
                lblMsg.Text = "Records not entered. Try again..!!!";
                lblMsg.Visible = true;

            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 23-Dec-12 5:01am
Updated 23-Dec-12 5:52am
Md. Humayun Rashed 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.

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100