Friday, March 23, 2012

how can I open a .mdf aspnetDB DataBase ?

Hello everybody,

I am working with SqlExpress and MSSQL Server Management Studio Express and do not manage to open the aspnetDB .mdf database in which I am storing all data about my users.

I woulds like to open it and to be able to request it in order to check some strange things.

Actually, I'm experiencing an isssue with that database since the request just below gives me two results for only one user:

SELECT Member.Password, Member.PasswordAnswerFROM aspnet_MemberShip Member, aspnet_Users UsersWHERE Member.UserId=Users.UserIdAND Users.UserName='Admin'

Using this request returns me a user whom password is clear and an identical user whom password is hashed whereas I set PasswordFormat="Clear" in my Web.Config

Could you explain me how I may proceed please?

Thanx for your help

If you still have your project open, it could be that the project has a lock on the database file. Close your project in order to use MS SSMS express.

Otherwise, you can right-click the ASPNET.MDF database file and choose 'Open'. This will allow you to navigate the database using the Server Explorer tab, much like you would with SSMS.

Your problem lies in your SQL, however. UserId is the only Unique column in the default Users table because it is the primary key. This means that the UserName is NOT unique, and could be duplicated.

Use System.Web.Security.Membership.Provider to get a reference to the app's default membership provider, and use that to do what you need. (See the System.Web.Security.MembershipProvider class for available functions.)

|||

Thanx for your answer ps2goat,

I finally used VisualStudio Servers's Explorer to do so and was able to see all the information stored in the .mdf file.

This raises some questions about the issue I was dealing about above, but at the time, it is a solution for that precise problem ;)

In fact, I had two identical usernames in the database, one with a password saved in clear and the other hashed and, as you tell it, with a different unique ID.

I believe this comes from the fact that I used this .mdf file in more than 3 versions of the current prooject, making of it some kind of mess where it becomes to difficult to find what you're looking for.

Thanks for your help.

|||

You can just use visual studio directly to navigate through it. Also you can get that into sql express or any other db and reconstruct all the db.

No comments:

Post a Comment