Chris Tybur
Chris Tybur

Reputation: 1622

Using AspCompat in a SharePoint web part page

I'm in the process of creating a SharePoint web part that needs to use a single-threaded COM component. I've discovered that in order to make this work well, I need to add the AspCompat="true" directive to the page where the web part will live. The problem is I can't seem to set up such a page.

I created a new blank web part page via the regular browser interface, then added AspCompat to it using SharePoint Designer. But that causes it to become un-ghosted and the SafeMode parser says that directive isn't allowed. I then modified the blank web part page template to include the directive and created a new page, but got the same error.

I basically need to set up a page within my SharePoint site that is stored in the file system, has that directive, and can contain my web part. How would I go about creating such a page?

Upvotes: 2

Views: 581

Answers (2)

Chris Tybur
Chris Tybur

Reputation: 1622

According to Microsoft SharePoint developer support, it is simply not possible to use AspCompat within a SharePoint site. The SPPageParserFilter class, which is the one that disallows certain page directives, is apparently involved in processing all pages, even those that are on the file system. See this blog post for more details.

Upvotes: 1

Chris Farmer
Chris Farmer

Reputation: 25396

I recently answered this question with some instructions that includes how to supply new site content page templates that you can use to host web parts. I think it's likely to work for you.

In your case, your aspx page template would have that AspCompat directive built-in.

Upvotes: 1

Related Questions