title: meteor + backbone multipage apps session get null after navigate
body: <p>Hi everyone i making a web apps use meteorjs.
  With backbone, finally i can make my web apps to be multipage.
  this is my router.js :</p>
  
  <pre><code>Router = {
      uri: _.compact(window.location.pathname.split("/")),
      routes: [],
  
      addRoute: function(route, template, session, currTemplateType) {
          var segments =  _.compact(route.split("/"));
  
          var placeholders = _.reduce(segments, function(currentArr, piece, index) {
              if (piece.substr(0, 1) === ":") {
                  currentArr.push(index);
                  segments[index] = piece.substr(1);
              }
              return currentArr;
          }, []);
  
          this.routes.push({
              segments: segments,
              template: template,
              placeholderIndexes: placeholders,
              session : session,
              currTemplateType : currTemplateType
          });
      },
      getMatchingRoute: function(){
          for (var i in this.routes) {
              var route = this.routes[i];
              var data = {};
  
              if (route.segments.length === this.uri.length) {
                  var match = _.every(route.segments, function(seg, i){
                      if (_.contains(route.placeholderIndexes, i)) {
                          data[seg] = this.uri[i];
                          return true;
                      } else {
                          return seg === this.uri[i];
                      }
                  }, this);
  
                  if (match) {
                      return {
                          data: data,
                          template: route.template,
                          session: route.session,
                          currTemplateType: route.currTemplateType
                      }
                  }
              }
          }
          //no matches (add 404 or default template maybe?)
          return false;
      },
      run: function(){
          var route = this.getMatchingRoute();
          if (route) {
              var fragment = Meteor.render(function() {
                  if (Template[route.template] !== undefined) {
                      return Template[route.template](route.data);
                  }
              });
              Session.set(SessionLookUp.pageByURL, route.session);
              Session.set(SessionLookUp.currentTemplateType, route.currTemplateType);
              if(route.currTemplateType !== TemplateType.login){
                  var isLog =  "true";
                  if(isLog === undefined || isLog === "false")
                      window.location.href = "/cust/login";
                  else{
                      document.body.appendChild(fragment);
                  }
              }
              else{
                  document.body.appendChild(fragment);
              }
          } else {
  
              var fragment = Meteor.render(function() {
                      return Template["404_page"](route.data);
              });
  
              document.body.appendChild(fragment);
          }
      }
  };
  </code></pre>
  
  <p>and this is some of my pager.js :</p>
  
  <pre><code>Router.addRoute('/cust/login', 'login', UserType.customer, TemplateType.login);
      Router.addRoute('/cust/register','cust_reg', UserType.customer, TemplateType.register);
      Router.addRoute('/cust/profile', 'cust_profile', UserType.customer,"");
  </code></pre>
  
  <p>So this is my case,
  user do login at localhost:3000/cust/login, after enter username and password, system will verify and navigate. If username and password match, so user will be directed to localhost:3000/cust/profile. this is how i navigate page :</p>
  
  <pre><code>Session.set(SessionLookUp.isLoggedIn, "true");
  window.location.href = "/cust/profile";
  </code></pre>
  
  <p>but there is something bad here, after that code execute, session back to null or undefined again.
  why this happend and how to solve this problem? Btw I create a custom login form, but i think the problem in how i direct the page.</p>