title: Getting value of UmbracoContext.Current as null
body: <p>I am having the following code on my Home Controller / Viewmodel class</p>
  
  <pre><code>public class HomeController : SurfaceController {
        ....
  
  
    [AllowAnonymous]   
  public ActionResult LoginIn()  
   {
      var user = new UserDetail() { FirstName = "FirstName", LastName = "LastName" };
      UserDetailViewModel model = new UserDetailViewModel() { User = user };
      return PartialView("~/Views/Partials/__LoginPartial.cshtml", model);
  
    }
       ........ 
  }
  
  public class UserDetailViewModel : RenderModel
   {    
          public UserDetailViewModel() : this(new UmbracoHelper(UmbracoContext.Current).TypedContent(UmbracoContext.Current.PageId)) { }
          public UserDetailViewModel(IPublishedContent content, CultureInfo culture) : base(content, culture) { }
          public UserDetailViewModel(IPublishedContent content) : base(content) { }
          public UserDetail User { get; set; } 
      }
  </code></pre>
  
  <p>And following is the ActionExcuteFilter</p>
  
  <pre><code>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public sealed class ActionExcuteFilter : ActionFilterAttribute {
      public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          if (HttpContext.Current.Session == null || Convert.ToInt32(HttpContext.Current.Session["UserId"]) ==0)
          {
              var myAccountPage = uQuery.GetNodesByType("Login").FirstOrDefault();
  
              filterContext.Result = new RedirectToRouteResult(
                  new RouteValueDictionary {
                  { "action", "LoginIn" },
                  { "controller", "Home" }});
  
          }
          base.OnActionExecuting(filterContext);
      } }
  </code></pre>
  
  <p>And on Home page have the following link</p>
  
  <p><a href="http://localhost/Products?categoryId=1" rel="nofollow">http://localhost/Products?categoryId=1</a> Which refer to action of product controller.</p>
  
  <p>So if user get login, and click on link everything works fine. (Means to say getting the value from UmbracoContext and respective pages get rendered )</p>
  
  <p>But when user Click on the link without login trouble starts (get error while fetching the values from UmbracoContext )</p>
  
  <p>So the Execution is:</p>
  
  <p>Product controller is call > ActionExcuteFilter > RedirectToRouteResult > Home Controller >LoginIn Action > UserDetailViewModel > Gives error (getting UmbracoContext.Current as null)</p>
  
  <p>So what I am trying to do is that, when user try to access page ..Product?categoryId=1 without login he should be redirect to login page.</p>
  
  <p>Thanks in advance :)</p>