Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql database

Author  Topic 

jithin.suresh
Starting Member

5 Posts

Posted - 2014-03-04 : 10:50:52
So, I have made a asp.net project for my college and have used sql server to connect to the database. I have designed a website which can only be accessed after logging in, every page attempt redirects to the login page if not already logged in. The password and username is stored in a .mdf file, here is the problem. I set the default password for logging in, and due to my great inefficiency, forgot it. Now i can not access my website and can not submit it. I have tried to access it using sql server management studio but the database won't open, though it is supposed to as per advice from the internet forums. Can I attach the .mdf file here and could anyone tell me the username and password or just give me a solution, i have tried all the basic methods to retrieve it. I am really at an impass here. Hope some kind programming god helps out.

jithin.suresh

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-03-04 : 12:27:43
quote:
Originally posted by jithin.suresh

So, I have made a asp.net project for my college and have used sql server to connect to the database. I have designed a website which can only be accessed after logging in, every page attempt redirects to the login page if not already logged in. The password and username is stored in a .mdf file, here is the problem. I set the default password for logging in, and due to my great inefficiency, forgot it. Now i can not access my website and can not submit it. I have tried to access it using sql server management studio but the database won't open, though it is supposed to as per advice from the internet forums. Can I attach the .mdf file here and could anyone tell me the username and password or just give me a solution, i have tried all the basic methods to retrieve it. I am really at an impass here. Hope some kind programming god helps out.

jithin.suresh

You can use a DAC connection to access the server and reset the password. Be sure to run everything "as administrator". Refer to this page http://technet.microsoft.com/en-us/library/ms178068(v=sql.105).aspx Also, you should connect to Database Engine Query - not to database engine.
Go to Top of Page

jithin.suresh
Starting Member

5 Posts

Posted - 2014-03-04 : 15:32:38
I had set the username and password as a varchar2 format inside the database. The login form accesses the database and retrieves the data inside the table i.e the username and password and then authenticates. I'm not sure how a DAC will help me here, would you mind telling me how i can do this ?

jithin.suresh
Go to Top of Page

jithin.suresh
Starting Member

5 Posts

Posted - 2014-03-04 : 15:36:56
this is the code i have used, i could change the database connections but every form i have created would need altering, which i can't possibly do as there are some 50 or so forms,
_____________________
int flag = 0;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["shopingConnectionString1"].ConnectionString);
string s = "select * from login";
SqlCommand com = new SqlCommand(s, con);
con.Open();
if (con.State == ConnectionState.Open)
{
SqlDataReader dtr;
dtr = com.ExecuteReader();
while (dtr.Read())
{
if (dtr[0].ToString().Equals(TextBox1.Text) && dtr[1].ToString().Equals(TextBox2.Text))
{


Response.Cookies["uname"].Value = TextBox1.Text;
Response.Cookies["pwd"].Value = TextBox2.Text;
Response.Cookies["role"].Value = dtr[2].ToString();
FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);

}
else
{
Label1.Text = "your credential are incorrect";
}


}

jithin.suresh
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-03-04 : 17:13:06
quote:
Originally posted by jithin.suresh

I had set the username and password as a varchar2 format inside the database. The login form accesses the database and retrieves the data inside the table i.e the username and password and then authenticates. I'm not sure how a DAC will help me here, would you mind telling me how i can do this ?

jithin.suresh

As I understood it, the issue you are facing is that you are not able to access the database and/or the server because you don't have the passwords.

Using DAC, you can get access to the database, and reset the passwords (or do anything else you may need to do - for example, create a new login and user who has enough privileges to what you need to do)
Go to Top of Page

jithin.suresh
Starting Member

5 Posts

Posted - 2014-03-05 : 03:28:06
How would i set up this DAC, pardon my state of illiteracy. Could you give me some pointers ?

jithin.suresh
Go to Top of Page

maunishq
Yak Posting Veteran

71 Posts

Posted - 2014-03-05 : 11:07:45
Did you get any solution to your problem?

=======================
Not an Expert, Just a learner.
!_(M)_!
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-03-05 : 15:36:59
quote:
Originally posted by jithin.suresh

How would i set up this DAC, pardon my state of illiteracy. Could you give me some pointers ?

jithin.suresh

That is exactly what the link that I posted in my first reply tells you http://technet.microsoft.com/en-us/library/ms178068

First, log on the computer on which you have SQL Server installed using an administrator login.

Next, launch SQL Server Management studio using "Run as administrator". (Find it in the program group, right-click and you will see the "run as administrator" option)

If a "connect to server" dialog comes up, click cancel on it.

Find the tool bar button for "Database Engine Query". If you hover over the standard toolbar buttons you will see it. Click on it, and then follow the instructions in that link that I gave above.
Go to Top of Page

jithin.suresh
Starting Member

5 Posts

Posted - 2014-03-06 : 00:07:52
Thanks a bunch sensei.


jithin.suresh
Go to Top of Page
   

- Advertisement -