nncq---见证子系统,跨站登录
=============
问题:我们公司外包出去一个系统,我们自己有做了一个,然后要实现跨站登录,登录A后,B里面也同时登录进去。
在我们做的这个见证子系统里面,再添加一个模块,然后下面的子页连接/jcsj/ReportInfo_cq/aspx/unitinfo.aspx(JCSJ是IIS jzqy下的子站)
涉及到很多地方 BaseController(判断是否登录有账户)、LoginController
![](/assets/blank.gif)
![](/assets/blank.gif)
=============
========BaseController===============BaseController===============BaseController
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
<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;"> </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="left: 0px; top: 0px" height="0" width="0"
codebase="JavaScript/install.cab#Version=1,0,6,413" classid="clsid:E740C5DF-3454-46A7-80EC-364D1ADB6CF0"></object>
<script src="Scripts/qinnailin.all.min.js"></script>
<script src="Scripts/jquery-ui/jquery-ui.all.min.js"></script>
<script>
$(document).ready(function () {
//登录表单
$("#flogin").Form({
success: function (data) {
if (data.error==0) {
loading(true);
$("#showerror").text("登录成功!正在跳转页面!").removeAttr("style");
window.location.href = "/";
} else {
loading(false);
$("#showerror").text(data.msg);
}
},
error: function (data) {
loading(false);
$("#showerror").text(data.msg);
}
});
//登录按钮
$("#btnlogin").click(function () {
$("#flogin").submit();
});
$(document).keydown(function (e) {
if (e.keyCode == 13) {
$("#flogin").submit();
}
});
});
</script>
</body>
</html>
========VHome Index.html===============VHome Index.html===============VHome Index.html
Layout = null;
}
<!DOCTYPE html>
<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=edge">
<title>广西建筑施工企业安全生产条件动态管理系统</title>
<link href="Content/frame/css/frame.css" rel="stylesheet" />
<link href="Content/frame/css/frame_skin1.css" rel="stylesheet" />
<link href="Content/qinnailin.all.min.css" rel="stylesheet" />
<link href="Content/frame/css/light-theme.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]-->
<style>
#div_iframe_home ul a {
color: #F0F2F5;
}
#div_iframe_home ul li {
float: left;
margin: 20px;
}
#div_iframe_home ul li p {
position: relative;
top: -22px;
}
#div_iframe_home ul li p span {
font-family: 'Applied Font Regular', 'Applied Font';
}
#div_iframe_home a:focus, #div_iframe_home a:hover {
color: #F0F2F5;
text-decoration: none;
}
#u32 {
position: relative;
top: 300px;
font-family: 'Applied Font Regular', 'Applied Font';
font-weight: 700;
font-size: 16px;
color: #008040;
clear: both;
}
hide {
display: none;
}
</style>
</head>
<body class="contrast-blue main-nav-closed">
<div class="header">
<div style="height:48px;overflow:hidden;width:100px;float:left;"><img src="Content/frame/img/logo.png" class="logo float_l" /></div>
<label style="font-size:25px;color:#ffffff;font-family:'宋体';line-height:48px;" class="logo float_l">广西建筑施工企业安全生产条件动态管理系统</label>
<div class="float_r menus_r">
<div class="head_menus head_menus_sa" href="javascript:">
<img src="Content/frame/img/user.png" /><span id="userlogin_info"></span>
</div>
<div style="display:none;" class="head_menus">
<img src="Content/frame/img/quick_menu.png" /><span>快捷</span>
<div class="detailed hide">
<ul class="q_menu_ul" id="menumore"></ul>
<p class="more_q_menu"><a class="short_icon" id="btncustom">更多</a></p>
</div>
</div>
<div id="message_div" class="head_menus head_menus_sa">
<img src="Content/frame/img/news.png" /><span>通知</span><a href="javascript:" id="noticesNum" class="notices"></a>
<div class="detailed hide" id="messagebox">
<div fm-body=fm-body class="notice_con">
<a class="notice showmsg" data-id="{{ID}}" href="javascript:" fm-conver="cutcontent">{{Title}}</a>
</div>
<p class="more_q_menu"><a id="morenotice" class="short_icon">更多</a></p>
</div>
</div>
<div style="display:none;" class="head_menus">
<img src="Content/frame/img/skin.png" /><span>换肤</span>
<!-- <div class="detailed detailed_s hide">
<a href="javascript:" id="frame_skin1" class="skins skin1"><img src="Content/frame/img/check_yes.png" class="yes_no show"></a>
<a href="javascript:" id="frame_skin2" class="skins skin2"><img src="Content/frame/img/check_yes.png" class="yes_no hide"></a>
<a href="javascript:" id="frame_skin3" class="skins skin3"><img src="Content/frame/img/check_yes.png" class="yes_no hide"></a>
</div> -->
</div>
<div class="head_menus">
<img src="Content/frame/img/logout.png" /><span id="btnloginout">退出</span>
</div>
</div>
<div>
<span id="span_config_search" style="display:none;" class="search float_r dropdown"><input type="text" id="div_autoc" /></span>
</div>
</div>
<div class="frame_main">
<div class="menus float_l">
<nav class="" id="main-nav">
<div class="navigation">
<ul class="nav nav-stacked" id="menus_ul"></ul>
</div>
</nav>
<div class="pre_next hide">
<span class="next"><a href="#">向上</a></span><span class="pre"><a href="#">向下</a></span>
</div>
</div>
<div class="main_tab float_l">
<div class="nav_main" style="float:left; position:relative;">
<ul id="ul_menu" class="nav_tab">
<li class="home_menu click" id="li_menu_home" data-menuid="home">
<a style="display:block;" class="t_style">首页</a>
</li>
</ul>
<ul class="links">
<li class="slid">
<a href="javascript:" class="showMenu"><img style="padding:11px 10px;border-right:1px solid #c8d7eb;" src="Content/frame/img/right_bg.gif" /></a>
<ul class="links1" style="display:none;">
<li class="closeA"><a href="javascript:">关闭全部</a></li>
<li class="refresh"><a href="javascript:">刷新当前</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="frame_list" class="pages float_l" >
<div id='div_iframe_home' style='height:100%'>
<iframe id="frame_home" data-menuid="home" class="hide" name="frame" frameborder="0" width="100%" height="100%"></iframe>
</div>
</div>
</div>
<script id="modaltemplatebox2" type="text/template">
<iframe id="modal-view-iframe" frameborder="0" width="940" height="100%"></iframe>
</script>
<div class="win_bg" id="basic-modal_frame1" style='display:none;z-index:9999;'></div>
<div class="win_bg" id="basic-modal_frame2" style='display:none; z-index: 9999;'></div>
<div id='basic-modal-content' style='display:none;'></div>
<div id='message-basic-modal-content' style='display:none;'></div>
<div id="msgshow-modal-content" style='display:none;'></div>
<div style="clear:both"></div>
<script src="Scripts/qinnailin.all.min.js"></script>
<script src="Content/frame/js/mainframe.js"></script>
<script>
$.post("/jcsj/login.aspx",@Html.Raw(System.Web.HttpContext.Current.Session["LogonSystemUser-login"]));
var frame= $.frame({
requestUrl: "IMenu",
editCustomMenuUrl: "",
ucenterUrl: "/pcs/staff/main.do",
newMsgUrl: "",
msgDetailUrl: "/Notic/Detail",
timeout: "",
delMsgUrl: "/pcs/msg/delMsg.do?jsonpCallback=?",
tagMsgUrl: "/pcs/msg/wdMsg.do?jsonpCallback=?"
});
/**
* 消息列表截取标题
*/
function cutcontent(str) {
return str.substring(0, 15) + "...";//消息列表中显示的字数
}
</script>
</body>
</html>
<script type="text/template" id="menutemplatex">
<li><a href="javascript:"><i style="display:none;" class="{{icon}}"></i><span>{{menuName}}</span>{{childicon}}</a>{{childs}}</li>
</script>
<script type="text/template" id="menutemplatec">
<li><a class="menu_goto_frame" data-menuid="{{menuId}}" data-parentid="{{parentId}}" data-menuname="{{menuName}}" data-href="{{url}}" target="frame">{{menuName}}</a></li>
</script>
<script type="text/template" id="messagetemplate">
<div id="message_box" style="width:800px;height:500px;overflow-y:auto;overflow-x:hidden;">
<div class="win_text">
<div style="text-align:left;text-indent: 2em;">
{{Body}}
</div>
</div>
</div>
</script>
<script type="text/template" id="customTemplate">
<div class="win_text" style="width:386px; height:295px;">
<div class="win_conTab" style="overflow:hidden;">
<div class="win_leftTb">
<div id="div_tree_box" style="padding-top:10px;"></div>
</div>
<div class="moveBg">
<a href="javascript:" id="customtoright"><img src="Content/frame/img/move_bg.png" /></a>
</div>
<div class="win_leftTb">
<table id="tablecustom" class="tabTable">
<tbody fm-body=fm-body>
<tr>
<td width="80%">{{menuName}}</td>
<td id='tr_cu_{{menuId}}' width="20%"><a href="javascript:" class="customadel" data-id="{{menuId}}" style="color:#f00;">X</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</script>
<script type="text/template" id="templatedome1">
</script>
========Login控制器========Login控制器========Login控制器
using fmtx.Framework.DALFactory;
using fmtx.Framework.DESC;
using fmtx.Framework.Web;
using NNCQ.Domain.Application;
using NNCQ.Domain.ViewModels.Applicaton;
using NNCQ.IWebBLL;
using NNCQ.SqlService;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Web.Mvc;
namespace NNCQ.Web.Controllers
{
public class LoginController : PubController
{
private readonly string SincerityValicode = ConfigurationManager.AppSettings["SincerityValicode"];
// GET: Login
public ActionResult Login(string loginName, string password)
{
var oldpwd = password;
password = NNCQ.IBLL.MD5.CalcMD5(password);
string sql = "select a.*,b.name as roleName,b.code as roleCode,b.issys as isRoleSys from t_sys_user a left join t_sys_role b on a.userrole = b.roleid where a.ACCOUNT = @loginName and a.password = @password";
SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@loginName", loginName),new SqlParameter("@password",password)};
DataTable bo = SqlDBHelper.Query(sql, paras);
if (bo.Rows.Count != 0)
{
var user = new LoginUserVM();
user.Name = bo.Rows[0].Field<string>("ACCOUNT");
user.CName = bo.Rows[0].Field<string>("USERNAME");
user.ChineseName =bo.Rows[0].Field<string>("USERNAME");
user.GroupCode = GroupCode.Administrator;
System.Web.HttpContext.Current.Session["LogonSystemUser"] = user;
System.Web.HttpContext.Current.Session["LogonSystemUser-login"] = "{username:" + loginName + ",password:" + oldpwd + "}";
return Json(new ResultVM(0, "登录成功!") { data = user });
}
else
{
return Json(new ResultVM(1, "用户名密码不正确!!"));
}
}
}
}
=============MD5=============MD5=============MD5=============MD5=============MD5
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NNCQ.IBLL
{
public class MD5
{
private static readonly int S11 = 7;
private static readonly int S12 = 12;
private static readonly int S13 = 17;
private static readonly int S14 = 22;
private static readonly int S21 = 5;
private static readonly int S22 = 9;
private static readonly int S23 = 14;
private static readonly int S24 = 20;
private static readonly int S31 = 4;
private static readonly int S32 = 11;
private static readonly int S33 = 16;
private static readonly int S34 = 23;
private static readonly int S41 = 6;
private static readonly int S42 = 10;
private static readonly int S43 = 15;
private static readonly int S44 = 21;
private static readonly byte[] PADDING;
private uint[] state = new uint[4];
private uint[] count = new uint[2];
private byte[] buffer = new byte[64];
private byte[] digest = new byte[16];
public MD5()
{
this.md5Init();
}
public byte[] GetDigest()
{
return this.digest;
}
public static string CalcMD5(byte[] by)
{
MD5 mD = new MD5();
mD.md5Init();
mD.md5Update(by, by.Length);
mD.md5Final();
StringBuilder stringBuilder = new StringBuilder();
byte[] array = mD.GetDigest();
for (int i = 0; i < 16; i++)
{
stringBuilder.Append(MD5.byteHEX(array[i]));
}
return stringBuilder.ToString();
}
public static string CalcMD5(string str)
{
byte[] bytes = Encoding.GetEncoding("GB18030").GetBytes(str);
return MD5.CalcMD5(bytes);
}
private void md5Init()
{
this.count[0] = 0u;
this.count[1] = 0u;
this.state[0] = 1732584193u;
this.state[1] = 4023233417u;
this.state[2] = 2562383102u;
this.state[3] = 271733878u;
}
private uint F(uint x, uint y, uint z)
{
return (x & y) | (~x & z);
}
private uint G(uint x, uint y, uint z)
{
return (x & z) | (y & ~z);
}
private uint H(uint x, uint y, uint z)
{
return x ^ y ^ z;
}
private uint I(uint x, uint y, uint z)
{
return y ^ (x | ~z);
}
private uint FF(uint a, uint b, uint c, uint d, uint x, int s, uint ac)
{
a += this.F(b, c, d) + x + ac;
a = (a << s | a >> 32 - s);
a += b;
return a;
}
private uint GG(uint a, uint b, uint c, uint d, uint x, int s, uint ac)
{
a += this.G(b, c, d) + x + ac;
a = (a << s | a >> 32 - s);
a += b;
return a;
}
private uint HH(uint a, uint b, uint c, uint d, uint x, int s, uint ac)
{
a += this.H(b, c, d) + x + ac;
a = (a << s | a >> 32 - s);
a += b;
return a;
}
private uint II(uint a, uint b, uint c, uint d, uint x, int s, uint ac)
{
a += this.I(b, c, d) + x + ac;
a = (a << s | a >> 32 - s);
a += b;
return a;
}
private void md5Update(byte[] inbuf, int inputLen)
{
byte[] array = new byte[64];
int num = (int)(this.count[0] >> 3 & 63u);
if ((ulong)(this.count[0] += (uint)((uint)inputLen << 3)) < (ulong)((long)((long)inputLen << 3)))
{
this.count[1] += 1u;
}
this.count[1] += (uint)(inputLen >> 29);
int num2 = 64 - num;
int num3;
if (inputLen >= num2)
{
this.md5Memcpy(this.buffer, inbuf, num, 0, num2);
this.md5Transform(this.buffer);
num3 = num2;
while (num3 + 63 < inputLen)
{
this.md5Memcpy(array, inbuf, 0, num3, 64);
this.md5Transform(array);
num3 += 64;
}
num = 0;
}
else
{
num3 = 0;
}
this.md5Memcpy(this.buffer, inbuf, num, num3, inputLen - num3);
}
private void md5Final()
{
byte[] array = new byte[8];
this.Encode(array, this.count, 8);
int num = (int)(this.count[0] >> 3 & 63u);
int inputLen = (num < 56) ? (56 - num) : (120 - num);
this.md5Update(MD5.PADDING, inputLen);
this.md5Update(array, 8);
this.Encode(this.digest, this.state, 16);
}
private void md5Memcpy(byte[] output, byte[] input, int outpos, int inpos, int len)
{
for (int i = 0; i < len; i++)
{
output[outpos + i] = input[inpos + i];
}
}
private void md5Transform(byte[] block)
{
uint num = this.state[0];
uint num2 = this.state[1];
uint num3 = this.state[2];
uint num4 = this.state[3];
uint[] array = new uint[16];
this.Decode(array, block, 64);
num = this.FF(num, num2, num3, num4, array[0], MD5.S11, 3614090360u);
num4 = this.FF(num4, num, num2, num3, array[1], MD5.S12, 3905402710u);
num3 = this.FF(num3, num4, num, num2, array[2], MD5.S13, 606105819u);
num2 = this.FF(num2, num3, num4, num, array[3], MD5.S14, 3250441966u);
num = this.FF(num, num2, num3, num4, array[4], MD5.S11, 4118548399u);
num4 = this.FF(num4, num, num2, num3, array[5], MD5.S12, 1200080426u);
num3 = this.FF(num3, num4, num, num2, array[6], MD5.S13, 2821735955u);
num2 = this.FF(num2, num3, num4, num, array[7], MD5.S14, 4249261313u);
num = this.FF(num, num2, num3, num4, array[8], MD5.S11, 1770035416u);
num4 = this.FF(num4, num, num2, num3, array[9], MD5.S12, 2336552879u);
num3 = this.FF(num3, num4, num, num2, array[10], MD5.S13, 4294925233u);
num2 = this.FF(num2, num3, num4, num, array[11], MD5.S14, 2304563134u);
num = this.FF(num, num2, num3, num4, array[12], MD5.S11, 1804603682u);
num4 = this.FF(num4, num, num2, num3, array[13], MD5.S12, 4254626195u);
num3 = this.FF(num3, num4, num, num2, array[14], MD5.S13, 2792965006u);
num2 = this.FF(num2, num3, num4, num, array[15], MD5.S14, 1236535329u);
num = this.GG(num, num2, num3, num4, array[1], MD5.S21, 4129170786u);
num4 = this.GG(num4, num, num2, num3, array[6], MD5.S22, 3225465664u);
num3 = this.GG(num3, num4, num, num2, array[11], MD5.S23, 643717713u);
num2 = this.GG(num2, num3, num4, num, array[0], MD5.S24, 3921069994u);
num = this.GG(num, num2, num3, num4, array[5], MD5.S21, 3593408605u);
num4 = this.GG(num4, num, num2, num3, array[10], MD5.S22, 38016083u);
num3 = this.GG(num3, num4, num, num2, array[15], MD5.S23, 3634488961u);
num2 = this.GG(num2, num3, num4, num, array[4], MD5.S24, 3889429448u);
num = this.GG(num, num2, num3, num4, array[9], MD5.S21, 568446438u);
num4 = this.GG(num4, num, num2, num3, array[14], MD5.S22, 3275163606u);
num3 = this.GG(num3, num4, num, num2, array[3], MD5.S23, 4107603335u);
num2 = this.GG(num2, num3, num4, num, array[8], MD5.S24, 1163531501u);
num = this.GG(num, num2, num3, num4, array[13], MD5.S21, 2850285829u);
num4 = this.GG(num4, num, num2, num3, array[2], MD5.S22, 4243563512u);
num3 = this.GG(num3, num4, num, num2, array[7], MD5.S23, 1735328473u);
num2 = this.GG(num2, num3, num4, num, array[12], MD5.S24, 2368359562u);
num = this.HH(num, num2, num3, num4, array[5], MD5.S31, 4294588738u);
num4 = this.HH(num4, num, num2, num3, array[8], MD5.S32, 2272392833u);
num3 = this.HH(num3, num4, num, num2, array[11], MD5.S33, 1839030562u);
num2 = this.HH(num2, num3, num4, num, array[14], MD5.S34, 4259657740u);
num = this.HH(num, num2, num3, num4, array[1], MD5.S31, 2763975236u);
num4 = this.HH(num4, num, num2, num3, array[4], MD5.S32, 1272893353u);
num3 = this.HH(num3, num4, num, num2, array[7], MD5.S33, 4139469664u);
num2 = this.HH(num2, num3, num4, num, array[10], MD5.S34, 3200236656u);
num = this.HH(num, num2, num3, num4, array[13], MD5.S31, 681279174u);
num4 = this.HH(num4, num, num2, num3, array[0], MD5.S32, 3936430074u);
num3 = this.HH(num3, num4, num, num2, array[3], MD5.S33, 3572445317u);
num2 = this.HH(num2, num3, num4, num, array[6], MD5.S34, 76029189u);
num = this.HH(num, num2, num3, num4, array[9], MD5.S31, 3654602809u);
num4 = this.HH(num4, num, num2, num3, array[12], MD5.S32, 3873151461u);
num3 = this.HH(num3, num4, num, num2, array[15], MD5.S33, 530742520u);
num2 = this.HH(num2, num3, num4, num, array[2], MD5.S34, 3299628645u);
num = this.II(num, num2, num3, num4, array[0], MD5.S41, 4096336452u);
num4 = this.II(num4, num, num2, num3, array[7], MD5.S42, 1126891415u);
num3 = this.II(num3, num4, num, num2, array[14], MD5.S43, 2878612391u);
num2 = this.II(num2, num3, num4, num, array[5], MD5.S44, 4237533241u);
num = this.II(num, num2, num3, num4, array[12], MD5.S41, 1700485571u);
num4 = this.II(num4, num, num2, num3, array[3], MD5.S42, 2399980690u);
num3 = this.II(num3, num4, num, num2, array[10], MD5.S43, 4293915773u);
num2 = this.II(num2, num3, num4, num, array[1], MD5.S44, 2240044497u);
num = this.II(num, num2, num3, num4, array[8], MD5.S41, 1873313359u);
num4 = this.II(num4, num, num2, num3, array[15], MD5.S42, 4264355552u);
num3 = this.II(num3, num4, num, num2, array[6], MD5.S43, 2734768916u);
num2 = this.II(num2, num3, num4, num, array[13], MD5.S44, 1309151649u);
num = this.II(num, num2, num3, num4, array[4], MD5.S41, 4149444226u);
num4 = this.II(num4, num, num2, num3, array[11], MD5.S42, 3174756917u);
num3 = this.II(num3, num4, num, num2, array[2], MD5.S43, 718787259u);
num2 = this.II(num2, num3, num4, num, array[9], MD5.S44, 3951481745u);
this.state[0] += num;
this.state[1] += num2;
this.state[2] += num3;
this.state[3] += num4;
}
private void Encode(byte[] output, uint[] input, int len)
{
int num = 0;
for (int i = 0; i < len; i += 4)
{
output[i] = (byte)((ulong)input[num] & 255uL);
output[i + 1] = (byte)((ulong)(input[num] >> 8) & 255uL);
output[i + 2] = (byte)((ulong)(input[num] >> 16) & 255uL);
output[i + 3] = (byte)((ulong)(input[num] >> 24) & 255uL);
num++;
}
}
private void Decode(uint[] output, byte[] input, int len)
{
int num = 0;
for (int i = 0; i < len; i += 4)
{
output[num] = (MD5.b2iu(input[i]) | MD5.b2iu(input[i + 1]) << 8 | MD5.b2iu(input[i + 2]) << 16 | MD5.b2iu(input[i + 3]) << 24);
num++;
}
}
private static uint b2iu(byte b)
{
if (b >= 0)
{
return (uint)b;
}
return (uint)(b & 255);
}
private static string byteHEX(byte ib)
{
char[] array = new char[]
{
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'a',
'b',
'c',
'd',
'e',
'f'
};
return new string(new char[]
{
array[ib >> 4 & 15],
array[(int)(ib & 15)]
});
}
static MD5()
{
// 注意: 此类型已标记为 'beforefieldinit'.
byte[] array = new byte[64];
array[0] = 128;
MD5.PADDING = array;
}
}
}
using fmtx.Framework.Web;
using NNCQ.IWebBLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace NNCQ.Web.Controllers.Views
{
public class VHomeController : Controller
{
// GET: VHome
/// <summary>
/// 首页
/// </summary>
/// <returns></returns>
public ActionResult Index()
{
var user = Session["LogonSystemUser"];
if (user == null)
{
var id = WebCookieHelper.GetCookie("nncq-user-cook-id", "zxcvbnma");
if (!string.IsNullOrEmpty(id))
{
var db = FactoryService.GetObject<ISession>();
var bo = db.Get(Guid.Parse(id));
Session["LogonSystemUser"] = bo;
if (bo != null)
{
return View();
}
return Redirect("/Login.html");
}
else
{
return Redirect("/Login.html");
}
}
else
{
return View();
}
}
public ActionResult Login()
{
return View();
}
/// <summary>
/// 显示错误信息!
/// </summary>
/// <param name="aspxerrorpath"></param>
/// <returns></returns>
public ActionResult ShowError(string aspxerrorpath)
{
var bean = (HandleErrorInfo)ViewData.Model;
return View();
}
public ActionResult LoginOut()
{
var id = WebCookieHelper.GetCookie("nncq-user-cook-id", "zxcvbnma");
if (!string.IsNullOrEmpty(id))
{
var db = FactoryService.GetObject<ISession>();
db.Remove(Guid.Parse(id));
}
Session.Clear();
WebCookieHelper.RemoveCookie();
//登出处理
return Redirect("/login.html");
}
}
}
nncq---见证子系统,跨站登录相关推荐
- (22)Ajax的基本使用(实现登录功能和局部刷新以及防止跨站请求伪造攻击)
Ajax的作用 前后端分离的项目,需要交互,就要通过Ajax来完成交互 AJAX(Asynchronous Javascript And XML)翻译成中文就是"异步Javascript和X ...
- python 全栈开发,Day87(ajax登录示例,CSRF跨站请求伪造,Django的中间件,自定义分页)...
python 全栈开发,Day87(ajax登录示例,CSRF跨站请求伪造,Django的中间件,自定义分页) 一.ajax登录示例 新建项目login_ajax 修改urls.py,增加路径 fro ...
- Cookie Session跨站无法共享问题(单点登录解决方案)
单点登录 什么是单点登录,举个例子,如果你登录了msn messenger,访问hotmail邮件就不用在此登录. 一般单点登录都需要有一个独立的登录站点,一般具有独立的域名,专门的进行注册,登录,注 ...
- 跨站访问如何保证session的正常使用
1.最近公司开发了一个网站项目,一切顺利.由于网页没有兼容手机浏览器,后来添加了一个webapp端,独立于另一个站点,用于解决兼容手机浏览器的问题.其中webapp端的数据全部通过ajax进行请求另一 ...
- Web框架之Django_09 重要组件(Django中间件、csrf跨站请求伪造)
摘要 Django中间件 csrf跨站请求伪造 一.Django中间件: 什么是中间件? 官方的说法:中间件是一个用来处理Django的请求和响应的框架级别的钩子.它是一个轻量.低级别的插件系统,用于 ...
- 跨站请求伪造(CSRF)-简述
跨站请求伪造(CSRF)-简述 跨站请求伪造(英语:Cross-site request forgery),也被称为 one-click attack 或者 session riding,通常缩写为 ...
- Django框架之跨站请求伪造
跨站请求伪造(英语:Cross-site request forgery),也被称为one-click attack或者session riding,通常缩写为CSRF或者XSRF, 是一种挟制用户在 ...
- 带你刷burpsuite官方网络安全学院靶场(练兵场)之客户端漏洞——跨站请求伪造(CSRF)专题
介绍 PortSwigger是信息安全从业者必备工具burpsuite的发行商,作为网络空间安全的领导者,他们为信息安全初学者提供了一个在线的网络安全学院(也称练兵场),在讲解相关漏洞的同时还配套了相 ...
- Java 过滤器解决URLSQL注入漏洞、跨站漏洞、框架注入漏洞、链接注入漏洞
一. 漏洞描述 1. 检测到目标URL存在SQL注入漏洞 很多WEB应用中都存在SQL注入漏洞.SQL注入是一种攻击者利用代码缺陷进行攻击的方式,可在任何能够影响数据库查询的应用程序参数中利用.例如u ...
最新文章
- C++:随笔3--复杂的数据结构
- Android studio 使用心得(三)—从Eclipse迁移到Android studio
- 某口腔app发现了不友善词汇(f*ckMobile)
- linux下c语言 双向链表
- Nodejs Guides(四)
- 豆瓣 为什么不用php,豆瓣网友是不是都疯了?
- I/O操作不占用CPU的任何线程
- HDFS 读取、写入、遍历文件夹获取文件全路径、append
- java实现一个简单的打字游戏
- Cxgrid控件中限制单元格输入类型以及显示格式
- 阿里云香港服务器速度快吗?
- windows 7 桌面图标变白板的问题解决方法
- SAP调用外围系统接口SXI_MONITOR有显示但是实际上没有调用接口的问题
- 【总结】办公编程学习你可能需要这些小利器!
- 中国剩余定理 即 孙子定理
- 在eclipse上配置tomcat,安装eclipse的JST Server Adapters Extensions时报错 Anerroroccurredwhilecollectingitems...
- 老男孩-筷子兄弟(歌词)
- 软件安全性测试有那些
- java如何让线程sheep_Java面试知识点之线程篇(三)
- 内存导致的电脑游戏中显示hdmi无信号 从而死机的情况