Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have read this article: http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html , and i put this line in my code: SPUtility.Redirect("Event.aspx", SPRedirectFlags.Trusted, HttpContext.Current); But debuger show me that is no Context. It don't cnow what context it is.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Answer to your problem is in the same article: http://www.sharepointkings.com/2008/05/httpcontext-in-eventhandler.html. Save HttpContext to the field in the constructor of your event handler class.

public class MyEventHandler: SPItemEventReceiver 
{
    HttpContext current;
    public MyEventHandler()
    { 
        current = HttpContext.Current;
    }
    ...
}
share|improve this answer
    
But it vrite me that method schould have return type. –  Grzegorz Z Oct 27 '12 at 19:35
    
And MyEventHandler() is getting underline red. –  Grzegorz Z Oct 27 '12 at 19:36
1  
MyEventHandler() is not a method, it is constructor. So, I think the problem is in incorrect syntax in your class. –  Dmitry Kozlov Oct 27 '12 at 19:44
    
So how I can it manage ? –  Grzegorz Z Oct 27 '12 at 22:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.