Monday, March 12, 2012

Logins to the website doesnt work after DB backing up and restoring

Hi all, plz help...

I have an asp.net login control on my website;

my users are stored in a SQL DB;

The problem is when I back-up my DB from my PC and restore it to my server; the logins doesn't work anymore. I mean the user I've created on my PC can't login on the website on the internet...

Thanks a lot...

I've had this same problem. If you delete the user from the database and re-add it, it will work. Does anyone know why this happens? Is there a numeric ID the server uses for the user name?|||

Thank god someone else had the same problem; it's been so long that I'm working on it that I allways thought it only happens to me..

Yes if I delete and then re-register same user it works but I can't say to my users please re-register:))

is there any way to programmaticaly do it? or any REAL solution??

How did you handle that? I mean does it work now?

|||Wait, when you say they are stored in a sql db, do you mean they are stored in a table or they are sql logins of the database? This happened to me when I had a user with a sql login.|||Backup/Restore does not transfer the logins. You need to generate the script to create the logins and run it to set the permissions after your restore.|||

They are in a table..

I'm not talking about SQL logins. Logins are aspnetdb logins for a web site. I mean users inside the aspnetdb_Membership and aspnetdb_Users tables...

|||The users may be in a table. You still need to run a script to SET the permissions for the users.|||

What script s that?

Users (I mean the user connecting by internet) already got permissions and re-mapped?

|||

The user exists in your table but he/she does not yet have the permissions to execute any scripts.

Check out BOL for sp_addlogin, sp_grantlogin, sp_defaultdb, etc.. If you are not sure of the scripts, try generating the script for existing logins.

|||

Hi,

I think the answer is hidden somewhere over there I didn't even realised that there could be that much stored procedure and functions... Anyways I found that sp's but I didn't understand anything:) how can I work em out from a query? Also I found "dt_validateloginparams" could that also be related?

Actually theres a parameter HasAccess like below:

EXEC

%%LocalLogin(Name= @.loginame).SetAccess(HasAccess= 1)

I think this is the key line but where does it store this HasAccess info? I couldn't find it in the tables?

Thanks a lot...

|||

In Enterprise Manager, right click on the DB -> All Tasks -> Generate Scripts -> Options tab -> select "Script SQL Server Logins" -> Back to General tab -> Click on Preview.

You can either paste the code into a stored proc and call it from your application or parameterize the scripts and use it for any login...as creative as you can get...

|||

Hi;

I'm sorry; I'm as lame as I couldn't figure it out. Maybe you already told me the answer but I don't know...

Could you please tell me what to do:)

Thanks a lot..

|||I just did. Thats the best I can do.|||Ok man; thanks.. I'll try..|||http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

No comments:

Post a Comment