nncq---见证子系统,跨站登录

本文介绍了如何在公司内部系统中实现跨站登录功能。通过在见证子系统添加模块,利用BaseController进行账户登录状态判断,以及LoginController配合MD5加密,确保用户在登录A系统后,B系统也能同步登录。详细涉及BaseController、login.html、VHome Index.html以及Login控制器的使用和MD5验证过程。
摘要由CSDN通过智能技术生成

=============

问题:我们公司外包出去一个系统,我们自己有做了一个,然后要实现跨站登录,登录A后,B里面也同时登录进去。
在我们做的这个见证子系统里面,再添加一个模块,然后下面的子页连接/jcsj/ReportInfo_cq/aspx/unitinfo.aspx(JCSJ是IIS  jzqy下的子站)
涉及到很多地方 BaseController(判断是否登录有账户)、LoginController


=============



========BaseController===============BaseController===============BaseController

using Microsoft.Practices.Unity;
using Newtonsoft.Json;
using NNCQ.Web.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using fmtx.Framework.DALFactory;
using NNCQ.Domain;
using NNCQ.Domain.ViewModels.Applicaton;
using fmtx.Framework.Web;
using NNCQ.Domain.Application;


namespace NNCQ.Web.Controllers
{
    public class BaseController : PubController
    {
        /// <summary>
        /// 如果没有登录信息则弹出登录框
        /// </summary>
        /// <param name="requestContext"></param>
        /// <param name="callback"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        protected override IAsyncResult BeginExecute(RequestContext requestContext, AsyncCallback callback, object state)
        {
            if (LogUser == null)
            {
                requestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");
                requestContext.HttpContext.Response.StatusCode = 500;
                requestContext.HttpContext.Response.Write(JsonConvert.SerializeObject(new ResultVM(1, "请登录") { isLogin = 1 }));
                requestContext.HttpContext.Response.End();
                return null;
            }
            else
            {
                return base.BeginExecute(requestContext, callback, state);
            }
        }




        /// <summary>
        /// 返回当前用户登录信息
        /// </summary>
        protected LoginUserVM LogUser
        {
            get
            {
                object user = System.Web.HttpContext.Current.Session["LogonSystemUser"];
                return user as LoginUserVM;
            }
        }
    }
}

========login.html===============login.html===============login.html



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=8,chrome=1" />
    <title>登录页面</title>
    <link href="Content/qinnailin.all.min.css" rel="stylesheet" />
    <link href="Content/frame/css/login.css" rel="stylesheet" />
    <link href="Scripts/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="Scripts/jquery-1.8.2.min.js"></script>
    <!--[if lte IE 9]>
    <script src="/Scripts/respond.min.js"></script>
    <script src="/Scripts/html5.js"></script>
    <![endif]-->
    <!--[if lte IE 7]><script>alert('您使用的IE浏览器版本过低!为了更好的体验本系统请升级您的浏览器!')</script><![endif]-->
    <script>


      $(function(){
     var conH = $(document).height();
 var mainH = conH-360;
 $(".bg_head").css("height" , mainH/2);
 $(window).resize(function(){
 var conH = $(document).height();
     var mainH = conH-360;
     $(".bg_head").css("height" , mainH/2);
 })
 })
    </script>
    <script>


      function change_pic(){
     var imgObj = document.getElementById("ok");
     if(imgObj.getAttribute("src",2)=="Content/frame/img/check_no.png"){
         imgObj.src = "Content/frame/img/check_yes.png";
         $("[name=remember]").attr("checked","true")
     }else{
         imgObj.src = "Content/frame/img/check_no.png";
         $("[name=remember]").removeAttr("checked");
     }
      }
    </script>
</head>


<body style="min-height:700px;overflow-y:auto;">
    <div class="bg_head">
        <img src="Content/frame/img/1.png" />
        <p style="font-size:20px;font-family:微软雅黑">广西建筑施工企业安全生产条件动态管理系统</p>
        <p style="font-size:20px;font-family:微软雅黑">---见证检测子系统</p>
    </div>
    <div class="bg_middle">
        <img class="pic_middle" src="Content/frame/img/ba_middle.png" width="100%" height="360" />
    </div>
    <div class="bg_foot">
        <p>技术热线:0771-6763683 18172033917 QQ群:575558186 115674193 577494286 563140565</p>
    </div>
    <form id="flogin" action="/Login/Login" fm-form="ajax" method="post">
        <div class="login_con">
            <div class="user_name">
                <span class="icon_name"><img src="Content/frame/img/icon_name.png" /></span>
                <span class="input_name">
                    <input type="text" placeholder="用户名" value="" id="uname" name="loginName" fm-null="请填写正确的姓名" />
                </span>
            </div>
            <div class="user_pwd">
                <span class="icon_pwd"><img src="Content/frame/img/icon_pwd.png" /></span>
                <span class="input_pwd"><input type="password" placeholder="密码" value="" id="upwd" name="password" fm-null="请填写密码" /></span>
            </div>
            <div class="but_login">
                <span class="login_but3"><a href="javascript:" id="btnlogin">密码登陆</a></span>
            </div>
            <div class="but_login" style="text-align:left;width:330px;">
                <div style="height:33px;width:294px;float:left;">
                    <div style="width:150px;float:left;"> <code id="showerror" style="color:red;">&nbsp;</code></div>
                </div>
            </div>




        </div>


    </form>


    <object id="epass1" style="left: 0px; top: 0px" height="0" width="0" data="data:application/x-oleobject;base64,oEm5THYJ1RGQywAAtMTEjwADAAAaAAAAGgAAAA=="
            classid="clsid:4cb949a0-0976-11d5-90cb-0000b4c4c48f" viewastext=viewastext></object>
    <object id="ePass" name="ePass" style="
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值