首先,我有一个网站A,设置域验证,打开时浏览器会自动弹出域验证的输入框。我在这个网站A里面放了一个页面,如果域账号登陆后,它会根据域账号,返回一串JSON内容:后面我有另外一个网站B,这个网站B默认可以不登录,可以查看信息,但如果要编辑,需要登录。我希望点右上角的登陆按钮后,可以访问网站A,弹出域验证输入框,输入后,网站B获取网站A页面返回的JSON,作为用户信息写入到Session里。
我的写法:protected void btnLogin_Click(object sender, EventArgs e)
{
HttpClient client = new HttpClient();
string json = client.GetAsync("http://172.31.168.164:82/adlogin2.aspx").ToString();
UserInfo newuser = JsonConvert.DeserializeObject<UserInfo>(json);
Session.Add("username", newuser.username);
Session.Add("employeeid", newuser.employeeid);
userinfo.Visible = true;
//loginlink.Visible = false;
//Session.Add("username", "28021278");
}但是返回错误是401 Unauthorized.
请问应该如何才能在网站B的登陆过程里,让网站A的登陆框弹出来呢?
我的写法:protected void btnLogin_Click(object sender, EventArgs e)
{
HttpClient client = new HttpClient();
string json = client.GetAsync("http://172.31.168.164:82/adlogin2.aspx").ToString();
UserInfo newuser = JsonConvert.DeserializeObject<UserInfo>(json);
Session.Add("username", newuser.username);
Session.Add("employeeid", newuser.employeeid);
userinfo.Visible = true;
//loginlink.Visible = false;
//Session.Add("username", "28021278");
}但是返回错误是401 Unauthorized.
请问应该如何才能在网站B的登陆过程里,让网站A的登陆框弹出来呢?
解决方案 »
- 用vs2010做的asp.net程序怎么发布到公司远程服务器上去啊
- 请教asp.net网站Inherits属性导致页面打开缓慢??
- 集成财付通担保交易一直提示“信息过期或者已经被修改”
- dataset如果批量导出excel?哪种方法比较好
- datagrid中如何选中行?
- 导出EXCEL后怎么不让在EXCEL中显示乱码?
- 能不能动态改变DataGrid列的列宽??
- 100分求教!怎样用javascript验证输入的文本框是合法的货币类型
- 高分求助???在SQL里怎么样做到:一条语句或一个存储过存一天才执行一次??
- web.config文件在运行的时候能否改变里面的值?
- vs2017安装成功可以用,过来2天打不开,只能用命令devenv/Safemode打开,
- 添加控制器出错
你用redis存储session作为共享session的媒介就好了。
window.frames['login'].location.href = "http://网站B/adlogin2.aspx";
alert(window.frames['login'].document.contentDocument.innerHTML);
}