Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bram Loquet 72 posts 102 karma points
    Nov 09, 2010 @ 09:11
    Bram Loquet
    0

    don't get my node back with linq after response.redirect

    With this code I just create a new umbraco node (OrderDocType) and refresh the current page,
    after the response.redirect I try to get my order back with linq.

    When I do so I don't get my node back until I hit F5.
    Does anybody know how to solve this problem?

            protected void Page_Load(object sender, EventArgs e)
    {
    if (Request["product"] != null)
    {
    var orderNr = DateTime.Now.ToString("yyyyMMdd") + "-" + StringHelper.TruncString(Guid.NewGuid().ToString().Replace("-", ""), 20, false);
    var docOrder = DocumentType.GetByAlias("OrderDoctype");
    var newOrder = Document.MakeNew(orderNr, docOrder, new User(0), 1234);
    newOrder.getProperty("orderNr").Value = orderNr;
    newOrder.Publish(admin);
    library.UpdateDocumentCache(newOrder.Id);

    CookieHelper.AddCookie("OrderNr", orderNr);

    var current = Node.GetCurrent();
    Response.Redirect(current.NiceUrl);
    }
    else
    {
    if (CookieHelper.GetCookie("OrderNr") != null)
    {
    var orderNr = CookieHelper.GetCookie("OrderNr");
    _ctx = new WebsDataContext();
    var order = (from o in _ctx.OrderDoctypes
    where o.OrderNr == orderNr
    select o).First();
    _ctx.Dispose();
    }
    }
    }

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies