Developer Forum »
Delete current node and then redirect
62 posts

Hi. I'd like to delete the node I'm currently visiting, and then redirect to another node. It fails before the redirection happens because the node does not exists anymore ;) How can I do this better?

 

int parent = WAFContext.Session.GetContent<HierarchicalContent>(WAFContext.Request.NodeId).Parent.GetId();

WAFRuntime.SystemSession.DeleteNode(WAFContext.Request.NodeId, true);

WAFContext.RedirectTo(parent);

62 posts

Ok, it works when I changed the redirect to 

Response.Redirect(WAFContext.GetUrl(parent));

I'm not sure if this is the best way to do it.

1