如何在自定义保存操作WFFM中获取Sitecore.Current.Site对象? [英] How to get the Sitecore.Current.Site object inside custom save action WFFM?

查看:94
本文介绍了如何在自定义保存操作WFFM中获取Sitecore.Current.Site对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用针对营销人员的Sitecore Web表单.在表单的save action中,我得到了Sitecore.Context.Site对象,但是该对象未返回正确的上下文.该值为"modules_shell". 有谁知道我如何获得正确的背景?

I'm using Sitecore Webforms For Marketers. In the save action of my form I get the Sitecore.Context.Site object, but the object doesn't return the right context. The value is "modules_shell". Does anyone know how I can get the right context?

非常感谢.

推荐答案

在不了解设置细节的情况下,我建议以与Sitecore的网站解析器相同的方式来确定正确的网站:

Without knowing the specifics of your setup I would suggest determining the correct site in the same way that Sitecore's site resolver does:

var url = System.Web.HttpContext.Current.Request.Url; 
var siteContext = Sitecore.Sites.SiteContextFactory.GetSiteContext(url.Host, url.PathAndQuery);

这篇关于如何在自定义保存操作WFFM中获取Sitecore.Current.Site对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆