SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql database
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jithin.suresh
Starting Member

India
5 Posts

Posted - 03/04/2014 :  10:50:52  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3593 Posts

Posted - 03/04/2014 :  12:27:43  Show Profile  Reply with Quote
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

India
5 Posts

Posted - 03/04/2014 :  15:32:38  Show Profile  Reply with Quote
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

India
5 Posts

Posted - 03/04/2014 :  15:36:56  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3593 Posts

Posted - 03/04/2014 :  17:13:06  Show Profile  Reply with Quote
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

India
5 Posts

Posted - 03/05/2014 :  03:28:06  Show Profile  Reply with Quote
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

Canada
71 Posts

Posted - 03/05/2014 :  11:07:45  Show Profile  Reply with Quote
Did you get any solution to your problem?

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

James K
Flowing Fount of Yak Knowledge

3593 Posts

Posted - 03/05/2014 :  15:36:59  Show Profile  Reply with Quote
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

India
5 Posts

Posted - 03/06/2014 :  00:07:52  Show Profile  Reply with Quote
Thanks a bunch sensei.


jithin.suresh
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000