I want to redirect using to another page after item added, main point is to redirect user to another page on item adding(item should be added first) or item added.


class ClassName: SPItemEventReceiver { HttpContext current; public ClassName() { current = HttpContext.Current; }

public override void ItemAdded(SPItemEventProperties properties)

        if (IamRightItem(properties))
            string webAppUrl = string.Empty;
            using (SPSite site = new SPSite(properties.SiteId))
                webAppUrl = site.WebApplication.GetResponseUri(SPUrlZone.Default).AbsoluteUri;

            if (!string.IsNullOrEmpty(webAppUrl))
                string redirectLink = string.Format("{0}{1}{2}{3}{4}", webAppUrl, "my/page.aspx", "?Action=abcAction", "&URL=", properties.WebUrl);
                SPUtility.Redirect(redirectLink, SPRedirectFlags.Trusted, current);

This code works for ItemUpdating but not for ItemAdded, why not :S

4 Answers 4


I have faced this issue before. After making the ItemAdded event synchronous, I was able to get the HttpContext but still the redirection was not happening. I solved it by doing the following workaround:

1) Use the ItemAdding Event (You have the HttpContext in it)

2) Add the item through code in the ItemAdding event itself.

3) After the item has been added, redirect using the SPUtililty.Redirect method.

Here is the sample code:

        HttpContext currentContext;  

        public CustomEventReceiver()
               currentContext = HttpContext.Current; 

        public override void ItemAdding(SPItemEventProperties properties)  

            SPList oList = properties.List;  

            this.EventFiringEnabled = false;  

            SPListItem newItem = oList.Items.Add();  
            newItem["Title"] = properties.AfterProperties["Title"].ToString();  

            this.EventFiringEnabled = true;  

            SPUtility.Redirect("http://server/redirectionPage.aspx", SPRedirectFlags.Default, currentContext);  

  • But it saying that Context is null.
    – Grzegorz Z
    Commented Nov 6, 2012 at 8:46
  • Make sure that you are using the ItemAdding event and not the ItemAdded event. Commented Nov 6, 2012 at 9:16

Here is an answer to a very similar question asked on SharePoint.StackExchange:

Redirect from ItemAdded event

  • my question is not a duplicate @ title as I couldn't find anyone mentioning SPUtility.Redirect in question link you provided, anyway thanks :) Commented Nov 5, 2012 at 14:05
  • Oh, I see... did you try making the event Synchronous? That way I believe you will have an HttpContext available and you will be able to use SPUtility.Redirect... Commented Nov 5, 2012 at 14:11
  • yup I got httpContext available and I am able to do it for item adding and updating. Commented Nov 5, 2012 at 14:15
  • I updated my question :) Commented Nov 5, 2012 at 14:28

It doesn't work because updated is asynchronous and called outside of the clients context.

You can create this using item updating, for after the updating event has occured, litterly doing a redirect on "Updated" but inside "Updating".

As I said before if you look for a tutorial on how to do this typing in "sharepoint Redirect for itemupdated using itemupdating" into google you will find plenty of tutorials on how to achieve this.


Is there any chance to redirect from Item Adding, but only once when Adding are finished. I tried many times., but Sometimes I got a error of Ribon, and sometimes I only updatet one record:

  • I am not sure if your asking me or telling me lol Commented Nov 5, 2012 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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