用户登录出现问题 怎么解决呀?虚心请教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using CBasic.Utility;using CBasic.ForumsWebService;using System.Net;using System.IO;using System.Text;using System.Xml;namespace CBasic.Web.UserControl{ public partial class User_Login : CBasic.Web.UserControlBase { protected void Page_Load(object sender, EventArgs e) { LoginButton.OnClientClick = "getElement('loginStat').style.display='';var u=getElement('" + UserName.ClientID + "');var p=getElement('" + UserPassword.ClientID + "');return checkLogin(u.value,p.value)"; } protected void Login_OnClick(object sender, EventArgs e) { if (!Validator.IsValidUserName(UserName.Text)) MessageBox.AlertMsg("用户名格式不正确", null); if (!Validator.IsValidPassword(UserPassword.Text)) MessageBox.AlertMsg("密码格式不正确", null); string username = UserName.Text; string password = Text.MD5(UserPassword.Text, 16); //Response.Write(Login(Config.Web.ForumsApiKeys, username, password)); //Response.End(); BLL.Passport passport = new BLL.Passport(); if (passport.MemberLogin(username, password) == null) MessageBox.AlertMsg("您输入的用户不存在或密码错误", null); //远程登录 //MemberPassport ws = new MemberPassport(); //string sysKey = Config.Web.ForumsApiKeys; //string r = ws.Login(sysKey, username, password); //Response.Write(r); //Response.Write("dv_dpo.asp?syskey=" + Text.MD5(username+sysKey, 16) + "&UserName=" + username + "&Password=" + password);//469e80d32c0559f8"); //Response.End(); //登录结束 Response.Redirect(FromUrl, true); } private string Login(string sysKey, string userName, string password) { string param = "syskey=" + sysKey + "&UserName=" + userName + "&Password=" + password + "&savecookie=0"; byte[] bs = Encoding.UTF8.GetBytes(param); //Response.ContentType = "text/xml"; XmlDocument doc = new XmlDocument(); string xmlPath = Server.MapPath("~/api_user.xml"); doc.Load(xmlPath); XmlNode root = doc.SelectSingleNode("/root"); root.SelectSingleNode("action").InnerText = "login"; root.SelectSingleNode("syskey").InnerText = sysKey; root.SelectSingleNode("username").InnerText = userName; root.SelectSingleNode("password").InnerText = password; sysKey = Text.MD5(userName + sysKey, 16); string url = "http://bbssilk.zsjdc.com/dv_dpo.asp"; //GET WebRequest wr = WebRequest.Create(url + "?" + param); wr.Method = "GET"; //wr.ContentType = "application/x-www-form-urlencoded"; //wr.ContentLength = bs.Length; //POST发送数据 /* using (StreamWriter sw = new StreamWriter(wr.GetRequestStream(), Encoding.UTF8)) { sw.Write(doc.OuterXml); sw.Close(); } */ //接收数据 WebResponse response = wr.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader sr = new StreamReader(stream, Encoding.UTF8); string result = sr.ReadToEnd(); sr.Close(); sr.Dispose(); stream.Close(); stream.Dispose(); //Response.Write(url + "::" + result); //Response.End(); if (string.IsNullOrEmpty(result)) return string.Empty; return result; } private string FromUrl { get { string url = Request.QueryString["from"]; if (string.IsNullOrEmpty(url)) return string.Format("{0}User/index{1}", CBasic.Web.Page.WebSite, CBasic.Web.Page.FileExtName); return Server.UrlDecode(url); } } }} 杨辉三角程序 学生系统 数据更新功能,不能马上更新该怎么办? bho注册问题 C#开发网络编程-应用层协议的选择问题? listbox显示字符串太长 关于动态创建panel及label的问题 请教啥叫"工作流",小弟不理解,那位大哥能帮我解释一下吗!谢谢! 能否给listbox加横向滚动条或者单鼠标放在选择项上能显示其选择的名称包括多选? C# 引用程序在另一台电脑上安装后运行报错 C#winform该用什么控件实现类似做菜步骤,一句话后面跟一张图片的效果, 单元测试疑难问题,求教高手 怎么利用循环将一个数组中的数值放大textBox中?
using CBasic.Utility;
using CBasic.ForumsWebService;
using System.Net;
using System.IO;
using System.Text;
using System.Xml;namespace CBasic.Web.UserControl
{
public partial class User_Login : CBasic.Web.UserControlBase
{
protected void Page_Load(object sender, EventArgs e)
{
LoginButton.OnClientClick = "getElement('loginStat').style.display='';var u=getElement('" + UserName.ClientID + "');var p=getElement('" + UserPassword.ClientID + "');return checkLogin(u.value,p.value)";
} protected void Login_OnClick(object sender, EventArgs e)
{
if (!Validator.IsValidUserName(UserName.Text))
MessageBox.AlertMsg("用户名格式不正确", null);
if (!Validator.IsValidPassword(UserPassword.Text))
MessageBox.AlertMsg("密码格式不正确", null); string username = UserName.Text;
string password = Text.MD5(UserPassword.Text, 16); //Response.Write(Login(Config.Web.ForumsApiKeys, username, password));
//Response.End(); BLL.Passport passport = new BLL.Passport();
if (passport.MemberLogin(username, password) == null)
MessageBox.AlertMsg("您输入的用户不存在或密码错误", null); //远程登录
//MemberPassport ws = new MemberPassport();
//string sysKey = Config.Web.ForumsApiKeys;
//string r = ws.Login(sysKey, username, password);
//Response.Write(r);
//Response.Write("dv_dpo.asp?syskey=" + Text.MD5(username+sysKey, 16) + "&UserName=" + username + "&Password=" + password);//469e80d32c0559f8");
//Response.End();
//登录结束 Response.Redirect(FromUrl, true);
} private string Login(string sysKey, string userName, string password)
{
string param = "syskey=" + sysKey + "&UserName=" + userName + "&Password=" + password + "&savecookie=0";
byte[] bs = Encoding.UTF8.GetBytes(param);
//Response.ContentType = "text/xml";
XmlDocument doc = new XmlDocument();
string xmlPath = Server.MapPath("~/api_user.xml");
doc.Load(xmlPath); XmlNode root = doc.SelectSingleNode("/root");
root.SelectSingleNode("action").InnerText = "login";
root.SelectSingleNode("syskey").InnerText = sysKey;
root.SelectSingleNode("username").InnerText = userName;
root.SelectSingleNode("password").InnerText = password; sysKey = Text.MD5(userName + sysKey, 16);
string url = "http://bbssilk.zsjdc.com/dv_dpo.asp";
//GET
WebRequest wr = WebRequest.Create(url + "?" + param);
wr.Method = "GET";
//wr.ContentType = "application/x-www-form-urlencoded";
//wr.ContentLength = bs.Length;
//POST发送数据
/*
using (StreamWriter sw = new StreamWriter(wr.GetRequestStream(), Encoding.UTF8))
{
sw.Write(doc.OuterXml);
sw.Close();
}
*/ //接收数据
WebResponse response = wr.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream, Encoding.UTF8);
string result = sr.ReadToEnd();
sr.Close(); sr.Dispose();
stream.Close(); stream.Dispose();
//Response.Write(url + "::" + result);
//Response.End();
if (string.IsNullOrEmpty(result))
return string.Empty;
return result;
} private string FromUrl
{
get
{
string url = Request.QueryString["from"];
if (string.IsNullOrEmpty(url)) return string.Format("{0}User/index{1}", CBasic.Web.Page.WebSite, CBasic.Web.Page.FileExtName);
return Server.UrlDecode(url);
}
}
}
}