Getting an error on login


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I just "upgraded" my app to use role based security.I think I did everything the Documentation asked however I am getting the following error and need some help on where I might have gone wrong

Private Shared Sub ShowLoginAndInitMainForm(ByVal e As ShowLoginAndInitFormEventArgs)

'-- Set the login form type to the appropriate form type (optional)

Login.LoginFormType = GetType(frmLogin)

'-- Show the login form and set the return value back to e.ShowMainForm

' The true value passed to the method tells the method to allow the

' end-user to cancel the login form, which will return False from the

' method.

error here-->e.ShowMainForm = Login.ShowLoginAndAuthUser(True)

End Sub

System.Reflection.TargetInvocationException was unhandled by user code
  Message="Exception has been thrown by the target of an invocation."
  Source="mscorlib"
  StackTrace:
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
       at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at MicroFour.StrataFrame.Security.Login.ShowLoginAndAuthUser(Boolean AllowCancel)
       at Payroll.AppMain.ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e) in C:\Action Labor Payroll 2006\Payroll\Payroll\AppMain.vb:line 118
       at MicroFour.StrataFrame.Application.StrataFrameApplication.Raise_ShowLoginAndInitializeForm(ShowLoginAndInitFormEventArgs e)
       at MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Well, the problem is coming from Activator.CreateInstance which means that it can either not find the fromLogin or it is not defined off of a SF Login Form template.

If you remove the line of code specifying the custom logon form, does the default logon form come up?

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Yep that works fine.

I used the login template to create the login form. I deleted and re added the custom form and still recieve the same error.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I did this just yesterday...so I know it will work Smile  The error that is being thrown is because Activator.CreateInstance cannot find the specified type...or it is throwing an error when it launches.

Is the custom login form in the same assembly as the Appmain.vb file?  It doesn't have to be, but I am just curious.

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Trent,

They are both in the same assembly. I used the Template to create the form and have not changed any thing in the template, This application has been in devlopment for awhile so I had to update the appmain following the directions in the Role based help. Is it possible that there is something that the login template form references that my app is missing?

P

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Oh sure...it is definitely possible Hehe .  One thing you might try is creating a new project off of the StrataFrame Application w/ Security and then look and compare to see if you are missing something.  If this doesn't work for you let me know and we can dig a little deeper.
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
this is from the inner exception

{"Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "Payroll.FrmLogin.resources" was correctly embedded or linked into assembly "Payroll" at compile time, or that all the satellite assemblies required are loadable and fully signed."}

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Trent,

I am getting the same problem on a vanilla application with security project.Here is the sample project.

Attachments
testapp.zip (227 views, 21.00 KB)
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Any ideas on this?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Well...it turns out that it is a very simple and easy to fix problem.  I will make sure that the template does not have this in it.  Open the LoginForm1.Designer.vb file and go to line 112.  There is a line of code attempting to set the header image on the gradient form header and pull it from a resource file that does not exist.  If you remove this line, the error will go away.  Another way to make it disappear it to just set the header image on the gradient form header.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search