Copied to clipboard

Flag this post as spam?

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


  • Phil 6 posts 26 karma points
    Aug 01, 2011 @ 16:01
    Phil
    0

    HttpContext.Current.User is null instead of empty string.

    I downloaded the Umbraco 4.6.1 source code from change set bcb384244a9c, and I am able to compile it and get it to run. However, if I include a user control on home page which accesses properties of the currrent user, it will crash because the HttpContext.Current.User is null.

    I have played around with this, and it seems that it is only null if you try to use the user control from the home page (i.e. the root page in the content tree). If you put the same user control on other pages, the current user property is the empty string.

    It does not seem to matter how you add the user control, whether you add the user control directly by using the @register directive in the template and directly referencing the user control, or whether you create a macro and call that, or if the macro you have created is added directly to the template, or is included in the content of a document which is based on that template.

    I have asked other people, and they can use exactly the same user control and it works fine on their home page because the current user is not null, so I think this a problem specific to installation or possibly my machine.

    I have tried installing the application as a stand alone using the web platform installer and the same user control works in that version, but I'd to get the source code version working because that's the version my team mates are using and the two versions have different templates. (Also, I get compiler errors with the web platform installer version so I can't insert breakpoints because the symbols don't load.)

Please Sign in or register to post replies

Write your reply to:

Draft