Copied to clipboard

Flag this post as spam?

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


  • Bert 128 posts 251 karma points
    Sep 01, 2009 @ 15:49
    Bert
    0

    Usercontrol & Server.transfer

    In my usercontrol I got a Server.transfer.

    HttpContext.Current.Server.Transfer(umbraco.library.NiceUrl(nodeID), true);

    I get an error thrown by

    System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)

    Am I missing a setting to disable this check from happening, or does umbraco and transfer just don't love eachother?

    Would RenderTemplate be an option?

  • Sean Mooney 131 posts 158 karma points c-trib
    Sep 01, 2009 @ 16:35
    Sean Mooney
    0

    I believe that Server.Transfer is looking for a "real/physical" page. You could try 

    HttpContext.Current.Response.Redirect(umbraco.library.NiceUrl(nodeID))

  • Bert 128 posts 251 karma points
    Sep 01, 2009 @ 17:10
    Bert
    0

    That will work indeed, but I need values from the refering page, so I need a transfer to be able to access the context items

  • Ron Brouwer 273 posts 768 karma points
    Sep 01, 2009 @ 17:48
    Ron Brouwer
    100

    The transfer is probably done after rewriting. Try using default.aspx?id=1234 or something like that.

  • Ron Brouwer 273 posts 768 karma points
    Sep 01, 2009 @ 17:49
    Ron Brouwer
    0

    Sorry, the id is not nessesary ofcource.

  • Roel Snetselaar 151 posts 305 karma points
    Sep 01, 2009 @ 19:02
    Roel Snetselaar
    0

    Not quite sure about the error message. But I'm wondering what your goal is? what do you want to achieve and won't you be able to do this using the altTemplate option?

  • Bert 128 posts 251 karma points
    Sep 02, 2009 @ 09:55
    Bert
    0

    Removed all context items and set them to Session variables.

    Redirecting now, no longer transfering.

  • Murray Roke 467 posts 875 karma points c-trib
    May 27, 2010 @ 02:32
    Murray Roke
    0

    To do a "Server.Transfer" equivalent in code behind, you can do something like this:

    Response.Write(umbraco.library.RenderTemplate(1234));
    Response.End();

    I had an issue transfering to default.aspx?id=1234 because it caused an infinite loop

  • Andy 10 posts 31 karma points
    Nov 29, 2011 @ 18:40
    Andy
    0

    Murray's answer worked for me. It might be possible to use one of the other Server methods (see http://forums.iis.net/p/1146511/1857360.aspx#1857360 for example) instead of Response.Redirect() to transfer control, but for now I'm using his since it does what I want, even if it does feel like a bit of a hack:

    Response.Write(umbraco.library.RenderTemplate(1234));
    Response.End();

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft