Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
sir,
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 23-Dec-12 5:01am
deeptul658
Edited 23-Dec-12 5:52am
v2
Comments
Md. Humayun Rashed at 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 at 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
Your Filters
Interested
Ignored
     
0 OriginalGriff 448
1 Sergey Alexandrovich Kryukov 425
2 Abhinav S 408
3 sanket saxena 285
4 Tadit Dash 160
0 Sergey Alexandrovich Kryukov 8,482
1 OriginalGriff 4,830
2 Peter Leow 3,794
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid