我为Sitecore的DMS功能创建了一个简单的演示站点.在sitecore内容中,我创建了这个结构:
首页
| -
个性化
.. | -HomeView1 .. | -HomeView2
HomeView1,HomeView2和Home具有相同的模板,其中只包含一个 Field: Display Text
现在我为主页创建Personalize,为它设置规则.规则是当前月份是8月,并将个性化内容指向HomeView1.当我做预览时,内容不会改变为HomeView1的文本.这是我的源代码:
public partial class HomePage : System.Web.UI.UserControl
{
protected Item currentItem;
protected void Page_Load(object sender, EventArgs e)
{
currentItem = Sitecore.Context.Item;
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我在主页上的内容
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HomePage.ascx.cs" Inherits="DMSDemo.sublayouts.HomePage" %>
<div><%= currentItem["Display Text"].ToString() %></div>
Run Code Online (Sandbox Code Playgroud)
我想知道为什么Sitecore.Context.Item在应用个性化规则时不会返回正确的项目(HomeView2)?
请给我一些建议.提前致谢.
我使用 Visual Studio 2008、.net Framework 3.5
我有一个 webservice 应用程序(一个使用 webservice 的 winform 客户端),我必须在管理员帐户中运行它
我需要将文件从 Windows 资源管理器拖放到此应用程序的窗体中。
这是我的代码:
this.AllowDrop = true;
private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
e.Effect = DragDropEffects.All;
}
private void Form1_DragDrop(object sender, DragEventArgs e)
{
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
foreach (string s in fileList)
{
MessageBox.Show(s);
}
}
Run Code Online (Sandbox Code Playgroud)
当我以普通帐户运行时它可以工作,但在管理员帐户中则不能。怎么解决呢?