R – Using Smart part for FBA site

sharepointwss

I have a use control which contains some ajax functionality. I made all necessary changes to make my site ajax compatible (i.e added respective tags in web.config) which works fine. I am using smart part to load this user control. But when i click on open the tool pane for the smart part it is giving me following.

Could not open user control path: System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\wwwroot\wss\VirtualDirectories\5252\UserControls' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption) at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption) at System.IO.Directory.GetFiles(String path) at SmartPart.UserControlToolpart.RenderToolPart(HtmlTextWriter output)

Please help me out to solve this error..

Best Answer

I had the same problem sometime back. Its more of the issue with the how the SmartPart works. It has the UserControlPath always pointing to the usercontrol path.

As per Jan (creator of SmartPart) comment you can change that in the DWP file. What you can do is to deploy the weppart and export the WebPart, open the dwp/webpart file in notepad, search for the text UserControlPath replace with your path. Upload the webpart back to sharepoint with different name and use the new webpart

One Issue is that it works for first time and again when I try to Edit or change the user control it changes back to the /UserControl.

What I have done to solve is took the copy of the code from Codeplex and made the UserControlPath property browsable true so that the path will be visible in the toolpart of the web Part.Below code snippet is present in the SmartPart.cs

    [Browsable(true),

    WebPartStorage(Storage.Personal)]
    public string UserControlPath {....}
Related Topic