SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a strange question for you. I have to fix bugs in the another's code (webpart for sharepoint 2010). So in the code there is a line with the code below:

  var s = (String)((PersonalWebPartPage)Page).Profile["AccountName"][0];

and then I tried to view next error appears:

Unable to cast object of type 'ASP._layouts_wpprevw_aspx' to type 'Microsoft.SharePoint.Portal.WebControls.PersonalWebPartPage'.  

But this code somehow working on the corporate portal. What it can be? =) Or maybe I've missing some references?

share|improve this question

Many kinds of pages can have Web Parts in them. Make sure that the actual page where the Web Part is deployed inherits from Microsoft.SharePoint.Portal.WebControls.PersonalWebPartPage.

Look for something like this:

<%@ Page Inherits="Microsoft.SharePoint.SharePoint.Portal.WebControls.PersonalWebPartPage,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.