Monday, March 12, 2012
Logins, Users, Roles, Schemas
I have just migrating my database From SQL2K to SQL2005. Users, Roles
and Schemas were all migrated. No issues there. Logins, on the other
hand, did not get migrated. Thus, I believe making Users, Roles, Schemas
orphans, correct?
If I re-create the login and assigning the login to the database, it
will give an error saying that the user already exists. So, I delete the
User, then it prompts me that I have a schema associated with it, so I
delete the schema, then create the user. Roles have not been touched.
Must I also update the roles? and I'm not sure what schemas are in
comparison to SQL 2000.
Please advise of a better way to deal with users, logins, roles and
schemas.
Thanks,
Audrey
*** Sent via Developersdex http://www.codecomments.com ***Perhaps these resources will help you.
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission Issues
When a Database Is Moved Between SQL Servers
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:egfRrmTzGHA.4580@.TK2MSFTNGP05.phx.gbl...
> Hi everyone,
> I have just migrating my database From SQL2K to SQL2005. Users, Roles
> and Schemas were all migrated. No issues there. Logins, on the other
> hand, did not get migrated. Thus, I believe making Users, Roles, Schemas
> orphans, correct?
> If I re-create the login and assigning the login to the database, it
> will give an error saying that the user already exists. So, I delete the
> User, then it prompts me that I have a schema associated with it, so I
> delete the schema, then create the user. Roles have not been touched.
> Must I also update the roles? and I'm not sure what schemas are in
> comparison to SQL 2000.
> Please advise of a better way to deal with users, logins, roles and
> schemas.
> Thanks,
> Audrey
>
> *** Sent via Developersdex http://www.codecomments.com ***|||Thanks for these articles. I have a slightly different issue. We moved a SQL
2000 database from server "A" to server "B" and there are now orphaned
users. They are actually old admins, etc., that we don't even want any more.
How do you delete these from a database? Is it as simple as just deleting
the logins from the database?
I haven't found anything on this topic and I would like some assurance that
it should work without croaking the database.
Thanks,
Ray
"Arnie Rowland" <arnie@.1568.com> wrote in message
news:%23afucvTzGHA.2208@.TK2MSFTNGP03.phx.gbl...
> Perhaps these resources will help you.
> http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
> Passwords Between SQL Servers
> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
> Restore
> http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to users
> http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
> Errors After Restoring Dump
> http://www.support.microsoft.com/?id=240872 How to Resolve Permission
> Issues When a Database Is Moved Between SQL Servers
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
> "Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
> news:egfRrmTzGHA.4580@.TK2MSFTNGP05.phx.gbl...
>|||Yes, if they are truly 'orphans', you can just delete them.
However, if they 'own' any objects, the deletion will fail. You will then
have to find those objects, and change the ownership to [dbo] before try
ing
the deletion again.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Ray" <no@.repliesplease.com> wrote in message
news:%23EFW%23FczGHA.3704@.TK2MSFTNGP02.phx.gbl...
> Thanks for these articles. I have a slightly different issue. We moved a
> SQL 2000 database from server "A" to server "B" and there are now orphaned
> users. They are actually old admins, etc., that we don't even want any
> more.
> How do you delete these from a database? Is it as simple as just deleting
> the logins from the database?
> I haven't found anything on this topic and I would like some assurance
> that it should work without croaking the database.
> Thanks,
> Ray
> "Arnie Rowland" <arnie@.1568.com> wrote in message
> news:%23afucvTzGHA.2208@.TK2MSFTNGP03.phx.gbl...
>|||Do sp_change_users_login 'report' to get a list of orphans before you decide
to do anything.
Also, check out this kb for more info.
http://support.microsoft.com/kb/274188
-oj
"Ray" <no@.repliesplease.com> wrote in message
news:%23EFW%23FczGHA.3704@.TK2MSFTNGP02.phx.gbl...
> Thanks for these articles. I have a slightly different issue. We moved a
> SQL 2000 database from server "A" to server "B" and there are now orphaned
> users. They are actually old admins, etc., that we don't even want any
> more.
> How do you delete these from a database? Is it as simple as just deleting
> the logins from the database?
> I haven't found anything on this topic and I would like some assurance
> that it should work without croaking the database.
> Thanks,
> Ray
> "Arnie Rowland" <arnie@.1568.com> wrote in message
> news:%23afucvTzGHA.2208@.TK2MSFTNGP03.phx.gbl...
>|||Thanks to the both of you.
Ray
"oj" <nospam_ojngo@.home.com> wrote in message
news:eSR$4wgzGHA.4648@.TK2MSFTNGP04.phx.gbl...
> Do sp_change_users_login 'report' to get a list of orphans before you
> decide to do anything.
> Also, check out this kb for more info.
> http://support.microsoft.com/kb/274188
>
> --
> -oj
>
> "Ray" <no@.repliesplease.com> wrote in message
> news:%23EFW%23FczGHA.3704@.TK2MSFTNGP02.phx.gbl...
>
Friday, March 9, 2012
Login with different Roles
Hello readers
I have a problem with the following:
I made a login page in Visual Web Developer 2005 and I used the ASP.net Configationtool in the Website menu. Made some couple test accounts to login and made a role: "Beheerders". Made 1 of my test accounts a "Administrators".
So my problem is when I log in with the account with the "Beheerders" role, i go to the page of the "normal user". I tried to look in many sites, I could find some nice aid but not 100% the one that could solve my problem.
This is my code i programmed in the seperatefile of Login.aspx
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Login
PartialClass LoginInherits System.Web.UI.Page
ProtectedSub Login1_LoggedIn(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Login1.LoggedInDim userinfoAs MembershipUser = Membership.GetUser(Login1.UserName)
Dim UserRol()AsString
UserRol = Roles.GetRolesForUser(userinfo.UserName)
If (Roles.IsUserInRole("Beheerders") =False)Then
Response.Redirect("~\Index.aspx")EndIf
EndSub
ProtectedSub Login1_LoggedIn()EndSub
ProtectedSub Login1_LoginError(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Login1.LoginError'Parameters instellen voor InvalidCredentialsLogDataSource
InvalidCredentialsLogDataSource.InsertParameters("ApplicationName").DefaultValue = Membership.ApplicationNameInvalidCredentialsLogDataSource.InsertParameters("UserName").DefaultValue = Login1.UserName
InvalidCredentialsLogDataSource.InsertParameters("IPAddress").DefaultValue = Request.UserHostAddressInvalidCredentialsLogDataSource.InsertParameters("Password").DefaultValue = Login1.Password
'Er was een probleem bij het aanmelden
'Nakijken of gebruiker bestaat in de databank
Dim userInfoAs MembershipUser = Membership.GetUser(Login1.UserName)If userInfoIsNothingThen
'Ongeldige gebruikersnaam...
LoginErrorDetails.Text ="Geen gebruiker met naam """ & Login1.UserName &""" in de databank !"
Else
'Nakijken of gebruiker Lockedout of Approved is
IfNot userInfo.IsApprovedThen
LoginErrorDetails.Text ="Uw account is nog niet goedgekeurd!"
ElseIf userInfo.IsLockedOutThen
LoginErrorDetails.Text ="Uw account is geblokkeerd wegens te veel mislukte aanmeldpogingen!"
Else
'Het wachtwoord was verkeerd
LoginErrorDetails.Text ="Verkeerd wachtwoord - """ & Login1.Password &""""
EndIf
EndIf
'Record wegschrijven naar datasource
InvalidCredentialsLogDataSource.Insert()
EndSubEndClass
Thanks for your help.
Regardings
Griffin1987
I believe your problem here is that in the loggedIn event, the cookie is not actually set yet. To get the name of the user, use the name from the control which I think is
login1.UserName