后台写js

   public ActionResult CheckLogon()
        {
            var con = "document.write('{0}')";
            if (AuthManager.UserWebIdentity == null)
            {
                const string text = "<div class=\"count_login\"><span>欢迎来到路游租车!</span><div class=\"login\"><a href=\"http://passport.luyou666.com/Account/Logon\">登录</a><a class=\"zhuce\" href=\"http://passport.luyou666.com/Account/VerificationPhoneUser\">注册</a></div></div>";
                con = con.FormatValue(text);
            }
            else
            {
                var text = "<div class=\"count_login\"><span><a href=\"http://my.luyou666.com\">" +
                           AuthManager.UserWebIdentity.Profile.LoginId +
                           "<img src=\"http://passport.luyou666.com/Content/User/icon/name.gif\" /></a>欢迎来到路游租车!</span><div class=\"tuichu\"><a href=\"/logout\">退出</a></div></div>";
                con = con.FormatValue(text);
            }
            return Content(con, MimeCollection.Js.ContentType);
        }

前端调用

  <script type="text/javascript" src="http://passport.luyou666.com/Account/CheckLogon"></script>

 

posted on 2014-11-27 10:21  利利乐园  阅读(303)  评论(0编辑  收藏  举报