Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Custom Membership - Exception of type 'System.ArgumentException' was thrown. Parameter name: encodedValue

$
0
0

Hope someone can help with this well known issue. It's so well reported on the forums but can't seem to find any solution that works. I have a custom membership and role provider that validate users from a normal custom sql table (not membership table). 

A problem seems to occur after user has been validated and a cookie is being created. When i omit the cookie, i get no problem and everything works fine.

So i guess the question is how can you create a token for a generic user successfully without getting this error. The error i'm getting is:

Exception of type 'System.ArgumentException' was thrown.
Parameter name: encodedValue

This is my code:

  SPSecurity.RunWithElevatedPrivileges(delegate()
           {
               string usernamestring = GetTextBox("tbUsername").Text;
               string passwordstring = GetTextBox("tbPassword").Text;


ATPAuthProvider.ATPMembershipProvider memProvider = new ATPAuthProvider.ATPMembershipProvider();

if (memProvider.ValidateUser(usernamestring, passwordstring))
                   {
                       MembershipUser user = memProvider.GetUser(usernamestring, true);
                       if (user != null)
                       {
   //All hell seems to break loose here...
                           FormsAuthentication.SetAuthCookie(user.UserName, false);
                           HttpContext.Current.Response.Redirect("/Pages/Home.aspx", false);
                       }

});

Any help is much appriciated


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>