X

ASP.NET MVC: Using NonActionAttribute to restrict access to public methods of controller

Public non-action methods in ASP.NET MVC controllers are source of problems because they can be called by user when not handled carefully. Same time you may need public methods on controllers for some other reasons (some UI framework, testability problems, things you cannot change etc). In this posting I will show you how to handle controller methods properly.

Unable to locate the xml-definition for CType with SPContentTypeId

When deploying your SharePoint solution to your development or test server where solution has been deployed before you may find errors like these in SharePoint log:Unable to locate the xml-definition for CType with SPContentTypeId and Failed to find the content type schema for ct-0-0x010100 during template lookup.

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive

When IIS is not configured properly after creating SharePoint application and there are web parts or features that use session you may get the following error: Unexpected error occured: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration. Solution As a solution you must register session state handler module in IIS. Open Internet Information Services manager. Move to site where problem occurred. Open modules…

Failed to get value of the "Approval Status" column from the "Moderation Status" field type control

When upgrading site from SharePoint 2007 to SharePoint 2010 or if somebody has tried to be extreme smart-ass you may get the following error when saving item or document to list where content approval is turned on: Failed to get value of the "Approval Status" column from the "Moderation Status" field type control. See details in log. Exception message: Input string was not in a correct format.

Could not find any resources appropriate for the specified culture (or the neutral culture) on disk

When you are building site definitions with localization support you may get the following error when creating new site: Provisioning did not succeed. Details: The site template was not provisioned successfully. Delete this site collection in Central Administration, and then create a new site collection. OriginalException: Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.

ASP.NET: Building tree picker dialog using jQuery UI and TreeView control

Selecting things from dialogs and data represented as trees are very common things we see in business applications. In this posting I will show you how to use ASP.NET TreeView control and jQuery UI dialog component to build picker dialog that hosts tree data.

The program w3wp.exe, with the assigned process ID, could not authenticate locally by using the target name HTTP/WEBSITENAME.

You may face this error when you are running your development environment on virtual server where you have also configured alternate access URL-s.The full message is something like this: “The program w3wp.exe, with the assigned process ID, could not authenticate locally by using the target name HTTP/WEBSITENAME. The target name used is not valid. A target name should refer to one of the local computer names, for example, the DNS host name. Try a different target name.”

Could not load file or assembly CabLib or one of its dependencies

When using WSPBuilder from command line you may get the following error: “Could not load file or assembly 'CabLib, Version=10.2.0.0, Culture=neutral, PublicKeyToken=5c838b77b53f84a0' or one of its dependencies. An attempt was made toload a program with an incorrect format.” This error occurs if there is something wrong with CabLib.dll or if CabLib.dll doesn’t exist in same folder with WSPBuilder.

5 minutes WIF: Make your ASP.NET application use test-STS

Windows Identity Foundation (WIF) provides us with simple and dummy STS application we can use to develop our system with no actual STS in place. In this posting I will show you how to add STS support to your existing application and how to generate dummy application that plays you real STS.

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. You don’t have Add and Customize Pages permissions required to perform this action.

After deploying your solution to SharePoint anonymous and read-only users may get the following error: Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. You don't have Add and Customize Pages permissions required to perform this action. Well, this is the case that is solved by famous this-issue-is-by-design (read: you have to find your own way how to solve the problem).