views:

32

answers:

2

Hi,

I have a problem adding web part to a blog default.aspx with stapling Feature. this is my code:

try
{
SPWeb web = (SPWeb)properties.Feature.Parent;
//SPFile thePage = web.RootFolder.Files["default.aspx"];
SPLimitedWebPartManager wpm = web.GetLimitedWebPartManager("default.aspx",PersonalizationScope.Shared);

.......

but every time I try to get default.aspx it says that file does not exist. Anyone can help me on this, because all the articles about adding web parts with features while site is creating (Stapling Feature) point on this kind of solution. Is there anything special?

Thanks, Darko

A: 

Is your Scope set to Web? In what event are you trying to add the WebPart?

F.Aquino
A: 

Are you activating your feature in a publishing web? It may not have a default.aspx in the root then, but in /Pages/Default.aspx

ArjanP