示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            IKernel         kernel         = NinjectWebCommon.Kernel;
            ISessionManager sessionManager = kernel.Get <ISessionManager>();
            SiteMapService  siteMapService = kernel.Get <SiteMapService>();
            UserInfo        u = new UserInfo();

            if (sessionManager.UserInfo != null)
            {
                u = sessionManager.UserInfo;
            }
            string jscontent =
                @"  var userInfo = {{ badge:'{0}',userName:'******',roleName:'{2}',roleID:'{3}'}};";//JSFileWriter.GetJS(CustomerId); // This function will return my custom js string

            jscontent = string.Format(jscontent, u.UserID, u.UserName, u.RoleName, "");
            IEnumerable <SiteMapMenu> menuList = GetMenuList(siteMapService.GetMap());

            Newtonsoft.Json.JsonSerializerSettings setting = new Newtonsoft.Json.JsonSerializerSettings();
            setting.ContractResolver = new CamelCasePropertyNamesContractResolver();
            string js = "var menuList = " + Newtonsoft.Json.JsonConvert.SerializeObject(menuList, setting);

            jscontent = jscontent + "\r\n" + js;


            context.Response.ContentType = "application/javascript";
            context.Response.Write(jscontent);
        }
        public ActionResult Index()
        {
            string url = HttpContext.Request.Url.AbsoluteUri;

            url = Regex.Replace(url, @"(\?|&)Token=.*", "", RegexOptions.IgnoreCase);
            ViewBag.UpdateUrl = string.Format("http://passport.wuxiapptec.sh.cn/MyInfoUpdate.aspx?BackURL={0}", url);
            ViewBag.Time      = DateTime.Now.ToString("yyyyMMddHHmmss");
            SiteMapMenu msn = _mss.GetMap();

            ViewBag.MapNodes = msn;
            return(View());
        }