Sharepoint 功能、各个站点级别的自定义 aspx 页面

发布于 2024-07-21 08:02:33 字数 822 浏览 7 评论 0原文

我在此处提出了类似的问题,但更具体的是。

我希望能够部署一个解决方案并激活一项功能,该功能可以将各种自定义 aspx 页面配置到我的网站内的不同站点级别。

所以我的第一个自定义 aspx 页面将位于根目录: http://example.org/custompage1.aspx

然后另一个自定义 aspx 页面将出现在更深的层次: http://example.org/subsite1/ custompage2.aspx

我的解决方案范围仅限于“网络”级别。 如果我在子站点级别激活该功能,我可以访问应出现在更深级别的自定义 aspx 页面,但是,我也可以访问应仅出现在网站根目录的其他页面,例如 http://example.org/subsite1/custompage1.aspx

这是错误的,错误的,错误的!

我尝试将该功能的范围限定为“站点”,但这似乎只提供了根自定义 aspx 页面,而不是应出现在网站更深层次的页面。

I've asked a similar sort of question here but what to be more specific.

I want to be able to deploy a solution and activate a feature that provisions various custom aspx pages to different site levels within my web site.

So my first custom aspx page would be at the root: http://example.org/custompage1.aspx

And then another custom aspx page would appear at a deeper level: http://example.org/subsite1/custompage2.aspx

I've got my solution scoped to the "web" level. If I activate the feature at the sub site level I can access the custom aspx page that should appear at this deeper level, but, I can also access the other page that should only appear at the root of the web site e.g. http://example.org/subsite1/custompage1.aspx

Which is wrong, wrong, wrong!

I tried to scope the feature to “site” but this only seemed to provision the root custom aspx page, not the page that should appear at the deeper level of the web site.

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

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

发布评论

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

评论(3

—━☆沉默づ 2024-07-28 08:02:33

“自定义 aspx”页面在 SharePoint 中称为“应用程序”页面,它们部署在 _layouts 目录中(通常为 C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS)。 Layouts 目录中的所有页面均可从 Web 应用程序中的每个站点访问。

如果您事先知道哪个页面与哪个网站相关,那么您可以在每个自定义页面中放置代码来检查是否从“无效”网站访问该页面,如果是,则抛出自定义 404 错误(请参见此处:ASP.NET 的隐藏功能)或类似的内容。

"Custom aspx" pages are known in SharePoint as "Application" pages, and they are deployed in the _layouts directory (usually C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS). All pages inside the Layouts directory are available from every site in the web application.

If you know in advance which page goes with which site then you could put code in each custom page that checks to see if it's being accessed from an "invalid" site, and if so, throw a custom 404 error (see here: Hidden Features of ASP.NET) or something similar.

彡翼 2024-07-28 08:02:33

您在功能 xml 中执行的任何操作都仅适用于激活该功能的站点。 如果您想根据相对 URL 跨多个站点执行某些操作,则需要设置功能接收器并使用自定义代码将文件/功能部署到其他站点。

最简单的方法可能是在解决方案中创建一个单独的 Web 范围功能,并让站点范围功能接收器在子站点上激活它。

Anything you do in the feature xml will only apply to the site on which the feature is activated. If you want to do something across multiple sites based on relative urls, you will need to set up a feature receiver and use custom code to deploy files/features to the other sites.

The easiest approach is probably to create a seperate web scoped feature within your solution and have the site scoped feature receiver activate it on subsites.

祁梦 2024-07-28 08:02:33

克洛菲尔给出了答案。 我只想补充一点,您可以在页面中使用 SPContext.Current.Web 来确定调用时您所在的网站。

Clorphil nailed the answer. I would only add that you can use SPContext.Current.Web within your page to determine which web site you are in when called.

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