调webservice,没有返回,直接
报 Invalid length for a Base -64 char array 错误。
string[] UserMsg = Global.WMS.CheckUserAndGetInfo(txtUserID.Text.Trim(), txtPWD.Text, out ErrMsg);
这句直接跳到catch
web端代码:
public string[] CheckUserAndGetInfo(string UserID, string PWD, out string ErrorCode)
{
Oracle.DataAccess.Client.OracleDataReader dr = null;
using (DataConnectKeep dc = new DataConnectKeep())
{
try
{
ErrorCode = "";
string[] Userinfo = new string[10] { "", "", "", "", "", "0", "0", "0", "0", "" };
string sql0 = "Select UserID,Password,UserName,SiteCode,RoleCode from Sys_User where Upper(UserID)='" + UserID.ToUpper().Trim() + "'";
dr = dc.ExecuteReader(sql0);
if (dr.HasRows)
{
dr.Read();
if (!PWD.Equals(dr["Password"].ToString()))
{
ErrorCode = "密码错误!";
if (dr != null) dr.Close();
return null;
}
if (dr["RoleCode"].ToString().Trim() == "")
{
ErrorCode = "用户没有分配角色,没有权限进行操作!";
if (dr != null) dr.Close();
return null;
}
Userinfo[0] = dr["UserID"].ToString();
Userinfo[1] = dr["Password"].ToString();
Userinfo[2] = dr["UserName"].ToString();
Userinfo[3] = dr["SiteCode"].ToString();
Userinfo[4] = dr["RoleCode"].ToString();
if (dr != null) dr.Close();
string sql1 = "select FuncID from Sys_RoleRight where ROLECODE='" + Userinfo[4] + "' AND FUNCID BETWEEN '6000' AND '6300'";
string[] FuncArray = dc.ExecuteArray(sql1);
for (int i = 1; i < FuncArray.Length; i++)
{
if (FuncArray[i] == "6000")
{
Userinfo[5] = "1";
}
if (FuncArray[i] == "6100")
{
Userinfo[6] = "1";
}
if (FuncArray[i] == "6200")
{
Userinfo[7] = "1";
}
if (FuncArray[i] == "6300")
{
Userinfo[8] = "1";
}
}
Userinfo[9] = dc.GetServerCurrentDateTime(4);
string strUpdateSql = "";
strUpdateSql += " insert into LOGINLOG ";
strUpdateSql += " (LOGINDATE,USERID,ROLECODE) values (TO_DATE('" + Userinfo[9] + "','YYYY-MM-DD HH24:MI:SS'),'" + Userinfo[0] + "','" + Userinfo[4] + "')";
dc.ExecuteNonQuery(strUpdateSql);
}
else
{
ErrorCode = "该用户不存在!";
if (dr != null) dr.Close();
return null;
}
if (dr != null) dr.Close();
return Userinfo;
}
catch (Exception e)
{
ErrorCode = "检查用户和获取信息失败!" + e.Message;
if (dr != null) dr.Close();
return null;
}
finally
{
if (dr != null) dr.Close();
dc.ConnectSqlClose();
}
}
}
可以确定没有return null 因为报的错是空引用。
调试一下,看看是具体哪一行报的错,有可能不是程序本身报的,而是oracle报出来的
检查下哪个地方用了base 64解码