使用FBA站点的智能部分

发布于 2024-07-29 02:14:35 字数 698 浏览 1 评论 0原文

我有一个包含一些 ajax 功能的使用控件。 我做了所有必要的更改以使我的网站 ajax 兼容(即在 web.config 中添加了相应的标签),效果很好。 我正在使用智能部分来加载此用户控件。 但是,当我单击打开智能部分的工具窗格时,它给了我以下信息。

无法打开用户控制路径:System.UnauthorizedAccessException:对路径“C:\Inetpub\wwwroot\wss\VirtualDirectories\5252\UserControls”的访问被拒绝。 在 System.IO.__Error.WinIOError(Int32 errorCode,字符串 MaybeFullPath) 在 System.IO.Directory.InternalGetFileDirectoryNames(字符串路径,字符串 userPathOriginal,字符串 searchPattern,布尔值 includeFiles,布尔值 includeDirs,SearchOption searchOption) 在 System.IO.Directory.GetFiles (字符串路径、字符串 searchPattern、SearchOption searchOption)位于 System.IO.Directory.GetFiles(字符串路径)位于 SmartPart.UserControlToolpart.RenderToolPart(HtmlTextWriter 输出)

请帮我解决此错误。

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..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你又不是我 2024-08-05 02:14:35

发生这种情况是因为您已将用户控件放在 SharePoint 无权访问的网站根目录的文件夹中。

通常,当您在 SharePoint 中部署用户控件时,您会将控件放入 CONTROLTEMPLATES 文件夹中,该文件夹映射到 IIS 中的 ~/_controltemplates 虚拟目录,默认情况下 SP 有权访问此文件夹。

然后,您可以将 SafeControl 条目放入此文件夹的 web.config 中。

  <SafeControl Src="~/_controltemplates/*" IncludeSubFolders="True" Safe="True"    AllowRemoteDesigner="True" />

该文件夹位于文件系统上的 <12HIVE>/TEMPLATE/CONTROLTEMPLATES 处。

This is happening because you have put the user control in a folder at the root of the site which SharePoint won't have access to.

Typically when you deploy a user control in SharePoint you put your control in the CONTROLTEMPLATES folder which is mapped to the ~/_controltemplates virtual directory in IIS, by default SP has access to this folder.

You can then put a SafeControl entry into your web.config for this folder

  <SafeControl Src="~/_controltemplates/*" IncludeSubFolders="True" Safe="True"    AllowRemoteDesigner="True" />

The folder is located at <12HIVE>/TEMPLATE/CONTROLTEMPLATES on the file system.

黑寡妇 2024-08-05 02:14:35

我以前也遇到过同样的问题。 更多的问题在于 SmartPart 的工作原理。 它的 UserControlPath 始终指向用户控件路径。

根据 Jan(SmartPart 的创建者)注释 您可以在 DWP 文件中更改它。 您可以做的是部署 weppart 并导出 WebPart,在记事本中打开 dwp/webpart 文件,搜索文本 UserControlPath 替换为您的路径。 使用不同的名称将 Web 部件上传回共享点并使用新的 Web 部件

一个问题是,当我尝试编辑或更改用户控件时,它会一次又一次地工作,它会更改回 /UserControl。

我要做的就是从 Codeplex 获取代码副本,并使 UserControlPath 属性可浏览为 true以便该路径在 Web 部件的工具部分中可见。下面的代码片段位于 SmartPart.cs 中

    [Browsable(true),

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

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 {....}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文