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
deeptul661
Edited 23-Dec-12 5:52am
221.6K
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
0 Sergey Alexandrovich Kryukov 588
1 George Jonsson 258
2 CPallini 200
3 OriginalGriff 174
4 Shemeemsha RA 140
0 OriginalGriff 5,985
1 Sergey Alexandrovich Kryukov 5,341
2 CPallini 4,760
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2014
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