Last post Feb 07, 2013 09:56 AM by cleanpro
Feb 04, 2013 09:52 PM|cleanpro|LINK
I am still working on my 1st mobile application (Visual Studio 2010, VB.net) and I get a error every time i attempt to "Log in" I am using the Nugent Simplemembership provider and I am sure that all of the plumbing is hooked up correctly. Below is the
error that I get in my AccountController.vb file.
"Invalid length for a Base-64 char array."
This line -> Membership.ValidateUser(model.UserName, model.Password)
is underline by intellisense as the cause..
' POST: /Account/Login
Public Function Login(ByVal model As LoginModel, ByVal returnUrl As String) As ActionResult
If ModelState.IsValid Then
If Membership.ValidateUser(model.UserName, model.Password)
If Url.IsLocalUrl(returnUrl) Then
Return RedirectToAction("Index", "Home")
ModelState.AddModelError("", "The user name or password provided is incorrect.")
' If we got this far, something failed, redisplay form
Feb 05, 2013 02:09 AM|roopeshreddy|LINK
Quickly replace the model.UserName and model.Password with some text, like this -
and try again. Check that works?
Feb 05, 2013 08:43 AM|cleanpro|LINK
Thanks for the reply. I added in some actual user account info as you suggested and i still get the same error as above "formatexception unhandled by user code" Invalid length for a Base-64 char array.
Feb 05, 2013 08:44 AM|cleanpro|LINK
I have googled this for a couple of days and I can't seem to find anything related to this issue..
Feb 05, 2013 09:47 AM|roopeshreddy|LINK
Can you show us the error details?
Feb 05, 2013 10:01 AM|cleanpro|LINK
at System.Convert.FromBase64String(String s)
at System.Web.Helpers.Crypto.VerifyHashedPassword(String hashedPassword, String password)
at WebMatrix.WebData.SimpleMembershipProvider.CheckPassword(IDatabase db, Int32 userId, String password)
at WebMatrix.WebData.SimpleMembershipProvider.ValidateUser(String username, String password)
at System.Web.Security.Membership.ValidateUser(String username, String password)
at RestorePro_Mobile.AccountController.Login(LoginModel model, String returnUrl) in c:\users\administrator\documents\visual studio 2010\Projects\RestorePro_Mobile\RestorePro_Mobile\Controllers\AccountController.vb:line 33
at lambda_method(Closure , ControllerBase , Object )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
Feb 05, 2013 10:19 AM|cleanpro|LINK
I don't get a browser error. After I click the login button I get diverted back to Visual Studio and I get the message that I initially posted.
Feb 06, 2013 01:28 AM|roopeshreddy|LINK
Error looks like Conversion of hash password using Base64 encoding, which is done internally!
Can you try creating quick sample app and install SimpleMembership from
Nuget and see whether you can reproduce the same!
It's pretty weird that it's throwing this error, which usually will happen when you attemp to write your custom logic for the Base64 conversion!
Feb 06, 2013 09:54 AM|cleanpro|LINK
Ok, I will give it a try. Thanks for getting back to me.
Feb 06, 2013 10:53 AM|cleanpro|LINK
I setup a new application and i am getting an error that i can hopefully fix soon.
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'WebMatrix.Data, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception
from HRESULT: 0x80131040)
I had to add a reference to the webmatrix.data dll and i also copied it to the bin folder and I am still getting the
error. I cleared the cache as well.
I have been stuck on the login issue for 4 days!!! Aaaargh...
Feb 06, 2013 11:01 AM|roopeshreddy|LINK
Check this similar problem solved here - http://forums.asp.net/t/1818527.aspx/1
Hope it helps u...
Feb 06, 2013 05:46 PM|cleanpro|LINK
Unfortunately that wasn't it either. I created another new application on a different machine (Imac) and I had the same problem. I am about ready to give up.....
Feb 07, 2013 12:47 AM|roopeshreddy|LINK
Just hold on! Let us try to fix this -
1. Can you tell the steps followe by you?
2. Can you provide me the link for the SimpleMembership which you have used? Is it a builtin one or third party membership?
Feb 07, 2013 09:56 AM|cleanpro|LINK
I went ahead and started a mvc 4 internet application. I will add some mobile pages to it.