hi all,

I need to implement functionality like how can i retrieve registered user's entered username and password for any website? and after that i want to save userid and password in some text,word file.

Any code/link is there then help me ASAP. help would be appreciated.


6 Years
Discussion Span
Last Post by Atul Dhiman

I think you need to explain yourself better. Do you mean how to retrieve the login details from a database to confirm they are registered users? What do you mean by 'any website'? When you say you want to save it to a text file I can only guess you don't have access to the database where the information is stored, otherwise that would be irrelevant.


First create a class file with access,oracle,or sql,
add data,data.sqlclient() namespace to the class and cs file both,
then add the following code in class file

public static bool match(string s)
            //to match record or data
            SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True");
            SqlCommand cmd = new SqlCommand(s, con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            int a = 0;
            if (a == 0)
                return false;
                return true;

then in the cs file code the following:

 string str = "select * from voter_reg where uid='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
            if (Class1.match(str) == true)
                string str1= "select applicant_no from voter_reg where uid='" + TextBox1.Text + "'";
                Session["app_no"] = Class1.str(str1); 
                Response.Redirect("Default3.aspx?u=" + TextBox1.Text);
                Response.Write("Invalid user id /password");


I have used the username as Applicant name in voter reg system,u can show it any text or label in the next page....

Hope u get it clear....

Edited by pyTony: fixed formatting


Mr krunalkakadia,

there is no code for anyone to get username and password of a person from any website unless you are some hacker or something. But there some access points to get access to the person id of his/her particular profile. e.g: email access. from here you can get users all contacts of friends but only if user insert by self the username & password.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.