Click here to Skip to main content
16,004,944 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionUsing skins in vb.net Pin
MohammadAmiry30-Apr-06 19:17
MohammadAmiry30-Apr-06 19:17 
AnswerRe: Using skins in vb.net Pin
Rizwan Bashir1-May-06 0:30
Rizwan Bashir1-May-06 0:30 
QuestionUpdating dataset Pin
Radiska30-Apr-06 17:43
Radiska30-Apr-06 17:43 
AnswerRe: Updating dataset Pin
barnamehnevis_vbnet30-Apr-06 23:46
barnamehnevis_vbnet30-Apr-06 23:46 
GeneralRe: Updating dataset Pin
Radiska1-May-06 11:47
Radiska1-May-06 11:47 
GeneralRe: Updating dataset Pin
Chatura Dilan1-May-06 17:08
Chatura Dilan1-May-06 17:08 
QuestionOLEDbCommand Locks entire Access Db Pin
jcrussell30-Apr-06 17:09
jcrussell30-Apr-06 17:09 
QuestionLogoff/logon in windows, app still running, change user Pin
B*C30-Apr-06 14:36
B*C30-Apr-06 14:36 
Here is my problem i'm authenticating a user say me, that is currently logged on, if he's in the correct role(group). If so and i'm an admin (group = app_admin) then no restrictions are set otherwise i will set restrictions, this functionality works, i can get the current user with windowsidentity.getcurrent, and so on.
I have a logon/logoff in my mainmenu that shows up a login form, where i put in a different username, password, and domain (now = computername), but domain function is also an option i would like to put in my app. since i'm building it in n-tier.
When i validate the user info from the login form and there is a user with the given password in the domain, it should change the windows logon or better use the windows logon to verify if user exists, so i can use the authentication trough the roles(groups) to set the restrictions if say it's a user (app_user) and not an admin, and set the username in statusbar, and keep the restrictions until a new login is performed, and that user belongs to a different group. Also need to logoff the current user, and say put in the most restrictions (or logon the default user with his default restrictions, wathever is the most simple/usable.)
And this is where it goes wrong, i use the logonuser (advapi.32) and get an error 1385, when cheking the new user login.
When i use the setting from the already logged on user he gives me no error and everething works fine.
So how can i logoff the current user and logon the new user without logging off windows, or making a new windows identity with the new user and associate him with my app so he will know the user and his role, when i get his windows.identity.
I know there is an impersonate, but that is not what i want, i think, please help me, i have searched throug the web and didn't find anything that states my problem, only geting winid, login automaticly, logoff windows, and so on but nothing that can help me.
partial code:
<pre>Private Function ValidateLogin() As Boolean
Try
Dim blnSuccess As Boolean = False
Dim UserName, Domain, Password As String

Domain = Me.txtDomain.Text
UserName = Me.txtUser.Text
Password = Me.txtPassword.Text

Dim token As IntPtr

If LogonUser(UserName, _
Domain, _
Password, _
LogonType.LOGON32_LOGON_INTERACTIVE, _
LogonProvider.LOGON32_PROVIDER_DEFAULT, token) = True Then
Return True
Else
Throw New System.Exception("Logon Failed. Error: " & _
GetLastError())
End If
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Loginfailure")
End Try
End Function </pre>

-- modified at 21:02 Sunday 30th April, 2006
AnswerRe: Logoff/logon in windows, app still running, change user Pin
B*C1-May-06 4:25
B*C1-May-06 4:25 
QuestionHelp displaying a structure in a sortedlist Pin
crash89330-Apr-06 11:18
crash89330-Apr-06 11:18 
AnswerRe: Help displaying a structure in a sortedlist Pin
Robert Rohde30-Apr-06 22:22
Robert Rohde30-Apr-06 22:22 
GeneralRe: Help displaying a structure in a sortedlist Pin
crash8931-May-06 7:31
crash8931-May-06 7:31 
GeneralRe: Help displaying a structure in a sortedlist Pin
crash8931-May-06 7:37
crash8931-May-06 7:37 
GeneralRe: Help displaying a structure in a sortedlist Pin
Robert Rohde1-May-06 20:12
Robert Rohde1-May-06 20:12 
QuestionMS office connections Pin
DoubleD82230-Apr-06 10:59
DoubleD82230-Apr-06 10:59 
QuestionHi , please help me Pin
Mohammed Amine30-Apr-06 6:27
Mohammed Amine30-Apr-06 6:27 
GeneralRe: Hi , please help me Pin
Guffa30-Apr-06 7:13
Guffa30-Apr-06 7:13 
AnswerRe: Hi , please help me Pin
Colin Angus Mackay30-Apr-06 21:07
Colin Angus Mackay30-Apr-06 21:07 
Questionwhat is behind this label ?? ;p Pin
Mohammed Amine30-Apr-06 5:56
Mohammed Amine30-Apr-06 5:56 
AnswerRe: what is behind this label ?? ;p Pin
_mubashir30-Apr-06 21:44
_mubashir30-Apr-06 21:44 
GeneralRe: what is behind this label ?? ;p Pin
Mohammed Amine1-May-06 0:47
Mohammed Amine1-May-06 0:47 
Questionprint out IN VB.NET 1.1 Pin
pankajgarg1230-Apr-06 4:59
pankajgarg1230-Apr-06 4:59 
AnswerRe: print out IN VB.NET 1.1 Pin
Dave Kreskowiak30-Apr-06 5:17
mveDave Kreskowiak30-Apr-06 5:17 
QuestionMove file to Directory Pin
lo_ol30-Apr-06 4:19
lo_ol30-Apr-06 4:19 
AnswerRe: Move file to Directory Pin
Dave Kreskowiak30-Apr-06 5:20
mveDave Kreskowiak30-Apr-06 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.