Without looking at your code it is hard for me to give you any type of exact answer, but some common errors include forgetting to set the security key and vector to the same in the AppMain.vb (or program.cs) (look in the InitApplication() method) and the security editor. These values must match:SecurityBasics.SetSecurityKeyAndVectorForUserAuthentication("MyKey")
Next, have you made sure that your data source has either the security tables or that you have set the security data source key to point to the proper database if they are not housed within your default database? This code will also be in the AppMain.vb or program.cs file. If you have deployed the security tables through the DDT to same database your applicaiton is using for everything else, then you do not need to do anything here. However, if you are storing the SFSxxx tables in a different database than your default, you must setup that data source as well and then set the SecurityDataSourceKey property:
SecurityBasics.SecurityDataSourceKey = "MyDataSourceKey"
Last, be sure to run and look at how the Role-Based Security sample is setup. This sample comes with the framework and you have the source code in both VB.NET and C#. Let us know if none of these options work for you and we will go from there.