-3

可能重复:
如何在 Tridion 中获取当前登录用户的 tcmid?

我在类库(dll)中编写了以下代码,并在配置文件 od Tridion 中添加了程序集引用,但我无法获得任何显示 user.Id 的窗口或警报,并且它没有给出任何错误。

[TcmExtension("Myevent")] 公共类 GetInfo : TcmExtension {

public GetInfo()
{
    EventSystem.Subscribe<User, LoadEventArgs>(OnUserLoad, EventPhases.TransactionCommitted);
}

private void OnUserLoad(User user, LoadEventArgs eventArgs, EventPhases phase)
{



    MessageBox.Show(user.Id);
    Console.WriteLine(user.Id);
}
4

2 回答 2

1

As I mentioned in my answer to your other question, you cannot use message boxes or console.writes to see information from an event system in SDL Tridion. You will have to revert to logging to the Tridion Event Log or debug your event system.

Remote debugging is possible as described in this msdn article, but I usually find it a nuisance to setup (provided you are not being blocked by firewalls between your dev machine and the CMS). So normally I simply revert to just instaling Visual Studio on the dev CMS server and debug the event system DLL directly from there, by attaching to the dllhost.exe process (see more details in this blog post).

And like I also mentioned in my answer to your other question, I'm still not convinced you can achieve your requirements in an event system. You might need to look at a UI extension or something completely different for logging active logins of a user. Technically, you are never logging into the SDL Tridion UI, since your password is validated by IIS, and not by the SDL Tridion web application.

ps. its better to edit your question if you want to give more info, its never a good idea to open up a duplicate question.

于 2013-01-23T09:08:20.260 回答
1

看起来您可能会混淆事件系统和 GUI 扩展。您订阅和事件处理程序的第一行代码是事件系统的一部分,并且实际上只能写入某种日志机制。你想达到什么目的?

当您在 CMS 服务器上使用 Visual Studio 调试代码时,您的代码执行时是否遇到任何断点?您的问题是 MessageBox 没有显示,还是您的代码根本没有运行。

于 2013-01-22T15:09:02.687 回答