Sharepoint lead is a place where you can read about interesting topics related to sharepoint, and you can also post comments and suggessions.

Sunday, January 6, 2013

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

I was configuring one of our clients farm which required FBA on different web applications (around 5) and he wanted each web application should have separate user store. That was too tricky since you just need to set up Application property of the membership provider and you are done.

After completion of these settings, all of my applications were having a common exception either in log out or login to the web application. Here was the exception.

System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue    at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

After checking all my steps right through starting. After getting all the other exeptions cleared the above exception was the only exception that I was getting. That was resolved using "Exception of type 'System.ArgumentException' was thrown" got error when i have signout from webapplication in sharepoint 2010?.

I hope this will help to you if you are getting same error due to a silly custom property of a custom web part for registration!

Sunday, December 30, 2012

SharePoint 2010 foundation on windows 7

If you are planning to install SharePoint 2010 foundation in your windows 7 machine, there are very good references out there in many blogs. But after I installed it I was not able to create new web applications.

I noticed, I was an administrator account with different name than administrator. I found here that we can enable in built administrator account.

I enabled administrator account and added it to managed accounts and farm administrators group.

After trying so many things from forums, finally I got everything working in SharePoint Foundation in my machine!

Friday, December 28, 2012

SharePoint 2013 FBA Pack

I tried to install SharePoint 2010 FBA Pack in SharePoint 2013 and it was working almost OK. I started facing some minor issues and I fixed them one by one.

Entire solution with my fixes is available as a BitBucket repository here

Following are list of issues and how I fixed them.

  1. When you go to add new user from user manager, and click on cancel, it was showing error
    Replaced code
    string url = "FBA/Management/UsersDisp.aspx";
                SPUtility.DetermineRedirectUrl(url,SPRedirectFlags.RelativeToLayoutsPage, this.Context,null, out url);
    string url = "/_layouts/FBA/Management/UsersDisp.aspx";
                //SPUtility.DetermineRedirectUrl(url,SPRedirectFlags.RelativeToLayoutsPage, this.Context,null, out url);
    So, in nutshell, when you are using the previous code, it redirects to /_layouts/15/FBA/UserDisp.aspx and our actual path is in 14 folder.
  2. Similar redirection problems where there when you click edit user and click on cancel, click on reset password and click on cancel etc. I fixed them all by replacing SPUtility.Redirect to Response.Redirect
  3. Use of upgraded user controls.
    When you go to any page, for example UserNew.aspx, you will notice that there are controls used in the page that are registered from "_controltemplates/xxxx.ascx", I upgraded them to use "_controltemplates/15/xxxx.ascx.
    You must be wondering how did I come to know about this? I looked at the page in 15 hive's admin folder and some random aspx page over there, I noticed the new path.
  4. Last one was, Due to SharePoint 2013 titles, breadcrumbs where causing long scroll. I updated resource file to update titles. I just updated titles and used "Manage Users", "Add Users" in place of using all long titles that are used out of the box.
  5. When I tried to package the solution after changes are done, It was giving me too long path error, so I renamed project name and package name to FBA. You will still able to install/upgrade it using stsadmin command.
This are really simple and small fixes, and only contains minor changes that make you able to work. If you have any other bugs, just post it to the public BitBucket repository that I have created and I will try to help you.

In next couple of posts we will discuss about adding customer properties through profile provider. If you have any other sugessions or feedback, I will be more than happy to hear back.

Wednesday, July 4, 2012

Not able to change page layout

Due to some problem in page, Page Layout button in ribbon is showing disabled.
Use following as QUICK solution if you are creating a new page:
  1. Delete newly created page
  2. Go to site settings > Page Layouts and Templates
  3. Locate "New page defualt settings" and select the page layout that you want to set as default page layout.
  4. Save setting
  5. Create new page
There can be many reasons of Page Laout showing disabled in ribbon. You can reference following links to go deeper and resolve it properly.
  1. Try check out the page and then go to edit mode of the page.
  2. Try different browsers to change page layout
  3. ​Change page layout using powershell
  4. Reference link 1​