2011-08-29 70 views

回答

0

我不知道你是否仍然有同样的问题。 反正以下链接可能有助于某人。

http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html

这一页,但是,不正确地解释HttpContext的是如何工作的

public class **CustomEventReceiver** : SPItemEventReceiver 
{ 
    private HttpContext _currentContext = null; 

    public CustomEventReceiver() : base() 
    { 
     if (null != HttpContext.Current) 
     { 
      _currentContext = HttpContext.Current 
     } 
    } 

    public override void ItemAdding (SPItemEventProperties properties) 
    { 
     // Here one can use _currentContext and redirect ... 
    } 
} 

应该牢记类名称必须以获得HttpContext的匹配。

此代码适用于我。