网页自登陆问题,求高人指点
问题:有两个系统,用户登陆一个系统后,想通过在这个系统中操作,直接登陆另外一个系统,中间不必再次系统登陆。已知另外一个系统信息:
首页(http://10.101.**.**/login.aspx)
用户名:xiaoming
密码:123456
页面代码:
..........
<form name="form1" method="post" action="login1.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
..........
<input name="Login1$UserName" type="text" id="Login1_UserName" style="width:138px;" />
<input name="Login1$Password" type="password" id="Login1_Password" style="width:138px;" />
<input type="submit" name="Login1$LoginButton" value="登录" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Login1$LoginButton", "", true, "Login1", "", false, false))" id="Login1_LoginButton" style="width:56px;" />
..........
请问该如何实现该功能? --------------------编程问答-------------------- string strId = "xiaoming";
string strPassword = "123456";
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "Login1$UserName=" + strId;
postData += ("&Login1$Password=" + strPassword);
byte[] data = encoding.GetBytes(postData);
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://10.101.**.**/login.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded;charset=gb2312";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
string content = reader.ReadToEnd();
Response.Write(content);
这是我自己写得,但返回的结果任然是login.aspx。 --------------------编程问答-------------------- 有人会么,在线等ing --------------------编程问答-------------------- 用 cookie 吧,,系统A登录成功,保存一个cookie,,系统B的登录页面首先检测cookie的信息,如果cookie正确,就自动登录 --------------------编程问答-------------------- 这样做,有点不安全 --------------------编程问答-------------------- 建议楼主看下sso技术信息。 --------------------编程问答-------------------- 用cookie实现
但是这么做不好吧,是两个不同的系统,怎么能互相登录呢。数据库的用户表数据是一致的吗?
补充:.NET技术 , ASP.NET